Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
    
Can you please post more of the actual stanzas you're using? –  slm Aug 13 '13 at 0:40

1 Answer 1

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>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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