0
votes

I have created the following directives in a VirtualHost tab in the configuration file for httpd:

      ScriptAlias /cgi-bin/ "/usr/myhome/cgi"
      <Directory "/usr/myhome/cgi/">
       AllowOverride None
       Options None
       Order allow,deny
       Allow from all
      </Directory>

I also created the shell script:

      #! /bin/sh

     echo "Content-type: text/html"
     echo
     echo
     echo Hello

in the /var/myhome/cgi directory.

Still, I can't run http://server.com/cgi-bin/1.sh

I get an "internal server error".

The httpd log file shows:

           [Mon Jul 28 21:18:19 2014] [error] [client 128.237.220.69] /bin/sh: /usr/myhome/cgi/1.sh: Permission denied
           [Mon Jul 28 21:18:19 2014] [error] [client 128.237.220.69] Premature end of script headers: 1.sh

This is even though I changed the permissions on the directory to be world readable and executable, and the script is also with chmod 0777 (just to make sure it can do anything).

Any ideas how to debug what the permission denied error source is?

1

1 Answers

0
votes

You at least need Options +ExecCGI and AddHandler cgi-script.

http://httpd.apache.org/docs/2.2/howto/cgi.html

edit: gah my bad I totally missed you were using ScriptAlias but I'm not sure your file path should be quoted?