Apache 2.2: Execute CGI script from user directory
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Apache 2.2: Execute CGI script from user directory
Hi all,
I try to execute a CGI script in a user directory, but all my browser is displaying is the source code! The same script works when called from the main cgi scripts location. After searching in the apache documentation, I think it's a user configuration problem but I can't fix it.
Here's the revelant (I think)parts of my httpd.conf :
Code:
...
LoadModule userdir_module modules/mod_userdir.so
...
DocumentRoot "/var/www"
<Directory />
Options FollowSymLinks ExecCGI
AllowOverride None
</Directory>
<Directory "/var/www">
Options Indexes FollowSymLinks ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<IfModule mod_userdir.c
UserDir html
</IfModule>
<Directory /home/*/html>
AllowOverride Options
Options Indexes FollowSymLinks ExecCGI
</Directory>
<Directory /home/*/html/cgi-bin>
AllowOverride Options
Options ExecCGI
SetHandler cgi-scripts
Order allow,deny
Allow from all
</Directory>
...
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
<Directory "/var/www/cgi-bin/">
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
</Directory>
...
In my home i have the directory tree "/home/jf.argentino/html" and "/home/jf.argentino/html/cgi-bin", both are "755", and I can browse the "/home/jf.argentino/html/index.html" file...
To Datopdog: If I SciptAlias "/cgi-bin/" to "/home/*/html/cgi-bin/" I can't run script from the main cgi location (/var/www/cgi-bin/), I have seen on boot up messages that there's a ScriptAlias overlap problem, but I can't found it in any httpd/log files! Can I have only one SrciptAlias directive?
To all: I add a change "<Directory /home/*/html/cgi-bin>" into "<Directory /home/*/html/cgi-bin/>" without more success.
After some google'ing, I found that It could be caused by SELinux, but as far as I know SELinux isn't loaded on my box, I'll look on that way.
Since apache shows you the code and does not run the script, then it does not read the "AddHandler .." directive. I don't think it's a SELinux problem, because you should get a "Forbidden" or "Not found" error.
Check again the config file and also make sure that you don't have a .htaccess file in ~/ or ~/cgi-bin, that overwrites the httpd.conf settings.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.