ScriptAlias configuration not working in apache2

2019-07-04 00:45发布

问题:

I installed apache2 on ubuntu. I added the following to /etc/apache2/httpd.conf file

ScriptAlias /cgi-bin/ "/home/PROJECT/cgi-bin/"

I am able to open the cgi file if i copy the cgi file to /usr/lib/cgi-bin/hello.cgi[DocumentRoot directory] and access the URL http://localhost/cgi-bin/hello.cgi, but i get cannot access the file if i put it in /home/PROJECT/cgi-bin/hello.cgi even though ScriptAlias is set and apache2 restarted.

Any thing that i am missing here ?

回答1:

I had the same problem. The reason was in httpd.conf, I had to remove global

ScriptAlias /cgi-bin/ /var/www/cgi-bin/

otherwise everything starting /cgi-bin/ fell into /var/www/cgi-bin/.