1

I'm using Apache on CentOS and am trying to run a Perl CGI script as directory index so it will run automatically as a subdomain. I added DirectoryIndex script.cgi and added a Directory stanza noting the path /var/www/folder enabling the script to run.

The only way the script would run is if I also add a File *.cgi stanza within the directory stanza (or even outside of it) and move the relevant section to it:

    Options +ExecCGI and SetHandler perl-script

I'm still learning Apache, and wondering why just referencing the folder wasn't enough. Why do I also have to add a File stanza and reference *.cgi? The CGI script would have been the only file in the folder.

  • 1
    Can you please post more of the actual stanzas you're using? – slm Aug 13 '13 at 0:40
0

Since you want to execute a cgi-script, apache2 needn't to know about perl. So I'd remove the SetHandler directive.

To debug it, look at your /var/log/apache2/error.log or similar. Your directory has to be accessible by apache. The script you like to execute need to have the execution flag set.

Example config:

    ScriptAlias /cgi-bin/ /var/www/cgi-bin/
    <Directory "/var/www/cgi-bin/">
            AllowOverride None
            Options +ExecCGI -MultiViews
            Order allow,deny
            Allow from all
    </Directory>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.