LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   apache fail to pick the DirectoryIndex index.py (https://www.linuxquestions.org/questions/linux-server-73/apache-fail-to-pick-the-directoryindex-index-py-751720/)

hiarunn 09-01-2009 04:28 AM

apache fail to pick the DirectoryIndex index.py
 
Here is the scnerio.
I have hosted some cgi-scripts on my web server and I want my web server to serve the script when I access just the URL http://myhost.example.com/

I configured the virtual host directive as below.

<VirtualHost *:80>
ServerName myhost.example.com
ServerAlias myhost
DocumentRoot /home/arun/www/html
ScriptAlias / /home/arun/www/cgi-bin
DirectoryIndex index.py
</Directory "/home/arun/www/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

Now, when I access the URL http://myhost.example.com/index.py, it works. But when I try to access the URL http://myhost.example.com/, the returning error "403 forbidden".

I guess DirectoryIndex works only with DocumentRoot and not with ScriptAlias. I could make it work by using ReWrite directive, but its again a work around I feel.

Appreciate any inputs on this regard.

bathory 09-01-2009 05:06 AM

Quote:

</Directory "/home/arun/www/cgi-bin">
I guess this is a typo. You mean <Directory "/home/arun/www/cgi-bin">.
Now to be able to execute scripts in the above dir, you need to add:
Code:

Options ExecCGI

hiarunn 09-01-2009 06:50 AM

Yup, its a typo. Sorry.

"Options ExecCGI" didn't work. Still apache couldn't pick the file index.py.

bathory 09-01-2009 07:09 AM

OK, use the following for the DocumentRoot:
Code:

<Directory "/home/arun/www">
DirectoryIndex index.py
Options ExecCGI
AddHandler cgi-script .py
</Directory>



All times are GMT -5. The time now is 07:54 AM.