Help - Search - Members - Calendar
Full Version: CGI execution problem apache
Linuxhelp > Support > Technical Support
isuck@linux
I have little hello world cgi script that I can't get to work.
If I place the script file within a real directory within my virtual host root directory the script works just fine.
Now I read that for security reason I should place my scripts within a directory external to my virtual's host directory, so I pointed all the ScriptAlias and <directory> permissions to this new external directory and gave the user execution permissions, but now it does not work. Is it there anythning else I'm missing?

This is the configuration that does not work:

ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/"

<Directory "/usr/local/awstats/wwwroot/cgi-bin/">
Options +ExecCGI
AddHandler cgi-script pl cgi
AllowOverride None
Order allow,deny
Allow from all
</Directory>

If I replace this config for the following one, everything works just fine:

ScriptAlias /awstats/ "/var/www/apache2-default/www.mydomain.com/cgi-bin/"

<Directory "/var/www/apache2-default/www.mydomain.com/cgi-bin/">
Options +ExecCGI
AddHandler cgi-script pl cgi
AllowOverride None
Order allow,deny
Allow from all
</Directory>

Permissions to the directories and scrits are set to the same. Am I missing something in httpd.conf or somewhere else that prevent my nobody apache user to execute scripts located in directories external to apache's www directory?? thanks is advance guys.
DS2K3
"It doesnt workk" is unfortunately rather vague. It could mean anything from a 403 (Fobidden) to a 505 (Internal Server Error). We need more info.

If poss, also post the relevant pieces of the Apache error log (if you have once)

D
isuck@linux
QUOTE (DS2K3 @ Aug 2 2006, 01:58 PM) *
"It doesnt workk" is unfortunately rather vague. It could mean anything from a 403 (Fobidden) to a 505 (Internal Server Error). We need more info.

If poss, also post the relevant pieces of the Apache error log (if you have once)

D



Yes, apache says I have no permission to access the file. That was my question, how permissions work with CGI, do I need at least 755 in the CGI folder or I also need at least 755 in the higher folder? thanks.
DS2K3
The folder must be readable and executable (which in folder terms means enter-able) by Apache itself. Generally, CGI scripts also need to be executable by Apache itself. For testing, make it 0777 (full permissions) and see if it works. If not, then it's probably Apache access rules that are stopping you.

Apache usually runs as user "nobody" or "httpd" - Try and find out which if possible since it is better not to leave things wiith full permissions.

D
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.