LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Can not access cgi-bin from browser. (https://www.linuxquestions.org/questions/linux-software-2/can-not-access-cgi-bin-from-browser-380793/)

Spreegem 11-07-2005 12:02 PM

Can not access cgi-bin from browser.
 
I'm installing a cgi script, and was going to try is, but when I try to get to the cgi-bin directory from my browser, it says 403 forbidden, even though the permissins for my cgi-bin folder are chmodded to 755. Any help would be greatly appreciated, thank you in advance.

ssfrstlstnm 11-07-2005 12:24 PM

What user is the web server running under? You have execute permissions set for the owner of cgi-bin so that means that the owner of cgi-bin needs to be the same as the user running the server.

Can you access html pages on the server?

Please post the relevant portion of your server config file.

Spreegem 11-07-2005 05:39 PM

How can I find out what user the server is running as, and yes I can access HTML pages, and what would be the relevant section of the server config file?

ssfrstlstnm 11-07-2005 06:05 PM

If you are using apache web server and have not yet looked at the config file you should do that now. It is probably in /etc/apache. It is usually called httpd.conf, but on my system is apache2.conf. Everything is pretty well commented so a lot of it is self-explanetory. The user and group tags are where you tell it what user should be running apache. This should normally be nobody, but on my debian system is www-data. Also pay close attention to Document Root and <Directory> directives. In my case these are in a subdirectory called sites-enabled. Also you may want to do some reading up on apache configuration. It can be a security risk if things are not set up right. And if your not using apache, then I can't help you cause that's all I know.

Spreegem 11-07-2005 06:25 PM

Ok, I changed the permissions on cgi-bin, my apache server is like yours, the user running it is www-data same with the group. Do I need to restart apache after I change the permissions on cgi-bin, becuase now I'm getting a 404 error, even though the cgi file is in cgi-bin.

ssfrstlstnm 11-07-2005 06:47 PM

You should not have to restart apache unless you changed something in the config file. 404 is file not found, so it seems you have the correct permissions set now. What are you typing in your browsers address line? Also make sure you have something like this in your config file and that the ScriptAlias directive points to where your scripts are (change /usr/lib/cgi-bin/ if you need to).

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

Spreegem 11-07-2005 08:22 PM

Thanks alot, I got it working now!


All times are GMT -5. The time now is 12:40 AM.