When my Apache installation tries to serve an executable file (web page) it gives an internal server error. I have installed and setup Apache under Cygwin under Windows XP. I am writing web pages for an embedded Linux system and using the setup above as a development/test platform. Each web page is a C program, compiled and linked to produce an executable using Cygwin and Gnu C. For example, the home page would be index.exe. When this program is executed on the Cygwin command line, it sends HTML to stdout that defines the web page. The HTML is valid per HTML 4.01 Transitional.
I attempted to configure Apache to execute all web pages as CGI scripts. Here are the significant lines from httpd.conf:
Apache works and serves HTML pages, but will not serve index.exe in the htdocs folder. The URL http://192.168.0.101/index.exe produces an internal server error. The error log reads:
[Tue Feb 05 09:02:56 2008] [error] [client 192.168.0.101] Premature end of script headers: index.exe
The access log reads:
192.168.0.101 - - [05/Feb/2008:09:02:56 -0700] "GET /index.exe HTTP/1.1" 500 535
Again, I know that index.exe produces valid HTML out. If I redirect its output to a file, say home.htm, then Apache will serve that HTML file just fine.
I guess I did something wrong in the config file, but I don't know what. I've read the documentation on the config parameters. I changed the ScriptAlias value from cgi-bin to htdocs because I want all the web pages in the main web folder, not in a separate place.
This is where I really struggle trying to understand. Why would CGI scripts be placed in a folder outside the main web site anyway? I also write PHP web sites served on hosted machines and I don't have to create a special folder for the PHP files.
Any help will be greatly appreciated. Thanks.
I attempted to configure Apache to execute all web pages as CGI scripts. Here are the significant lines from httpd.conf:
Code:
ServerRoot "/tools/apache"
DocumentRoot "/tools/apache/htdocs"
<Directory "/tools/apache/htdocs">
Options Indexes FollowSymLinks ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<IfModule alias_module>
ScriptAlias /cgi-bin/ "/tools/apache/htdocs/"
</IfModule>
<IfModule mime_module>
TypesConfig conf/mime.types
AddType text/html .exe
AddHandler cgi-script .exe
</IfModule>
[Tue Feb 05 09:02:56 2008] [error] [client 192.168.0.101] Premature end of script headers: index.exe
The access log reads:
192.168.0.101 - - [05/Feb/2008:09:02:56 -0700] "GET /index.exe HTTP/1.1" 500 535
Again, I know that index.exe produces valid HTML out. If I redirect its output to a file, say home.htm, then Apache will serve that HTML file just fine.
I guess I did something wrong in the config file, but I don't know what. I've read the documentation on the config parameters. I changed the ScriptAlias value from cgi-bin to htdocs because I want all the web pages in the main web folder, not in a separate place.
This is where I really struggle trying to understand. Why would CGI scripts be placed in a folder outside the main web site anyway? I also write PHP web sites served on hosted machines and I don't have to create a special folder for the PHP files.
Any help will be greatly appreciated. Thanks.
Comment