|
I set up Apache as webserver that hosts a webpage, and that works. But when I try to run my sh cgi script I get a "Internal Server Error", and the log shows as "...Premature end of script headers..." followed by a "...Zlib: Compressed..." for every browser attempt to load the file. I've even tried with close to the simplest script I could make; same results. I also ran `service apache2 restart` after making changes.
When run from the terminal, my sh script works like it's supposed to.
How can I get this working? Do I need to install something, change some setting, or do something else?
--------------------------------------------------------------------------------
#!/bin/sh
/bin/echo 'Content-type: text/html';
/bin/echo '';
/bin/echo '<head>';
/bin/echo '<title>LOCALCUPSLINK</title>';
/bin/echo '</head>';
/bin/echo '<body>';
/bin/echo '<p><a href="localhost:631">local cups webpage</a></p>';
/bin/echo '</body>';
/bin/echo '</html>';
--------------------------------------------------------------------------------
# latest version of playing around with /etc/apache2/sites-available/default
<VirtualHost *:80>
ServerAdmin soon,
DocumentRoot /var/www/html
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# This directive allows us to have apache2's default start page
# in /apache2-default/, but still have / go to the right place
#RedirectMatch ^/$ /apache2-default/
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AddHandler cgi-script .cgi .sh cgi.sh .sh.cgi
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
AddHandler cgi-script .cgi .sh cgi.sh .sh.cgi
Options +ExecCGI
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel debug
CustomLog /var/log/apache2/access.log combined
ServerSignature On
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
-------------------------------------------------------------------------------- |
|