I'm trying to make the root directory for a virtual host so that it can execute CGI scripts. I put the following in my virtual host declaration:

<VirtualHost *:80>
    <Directory />
    Options +ExecCGI
    </Directory>

    DocumentRoot /path/to/root
    ServerName servername
    AddHandler cgi-script .pl
</VirtualHost>
link|improve this question

70% accept rate
feedback

1 Answer

up vote 1 down vote accepted

Presuming you're wanting to allow cgi scripts to run in the root directory you're going to want to change the Directory section. I think you're confusing Directory with Location. Directory refers to a directory on disk whereas Location refers to a path from the document root.

So what you want is something more like:

<Directory /path/to/root>
    Options +ExecCGI
</Directory>

See Apache Tutorial: Dynamic Content with CGI for more info.

link|improve this answer
And generally the default apache conf already has "Directory /" defined with most options turned off for security. So perhaps the "Directory /" you (blockhead) defined is conflicting with that one. This solution from Hans should work. – kbosak Oct 14 '09 at 14:26
feedback

Your Answer

 
or
required, but never shown

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