View Full Version : httpd & CGI
Eli
2004-04-09, 06:33 PM CDT
I installed apache, and have a problem with getting my CGI scripts to work. Every time I try to access them, I get "Internal Server Error."
I saved them in /var/www/cgi-bin, which is where you are supposed to save them, but they still will not work. Mayday, mayday.:(
PERL does work though. I can execute my code, so that is not the issue, it is just a matter of turning CGI "on," I guess.
Eli
2004-04-09, 06:43 PM CDT
It was simply a matter of permissions. I had not chmod my script.
Jman
2004-04-10, 01:53 PM CDT
Access Denied errors also occur from messed up permissions.
The apache user needs to be able to read files under the web root, and execute scripts.
Eli
2004-04-11, 12:11 AM CDT
I have another problem. I am trying to give my regular user, bob, permission to execute his own CGI scripts and I have changed the default 'public_html' directory to 'html.' I am having no luck at pulling up bob's directory @ http://localhost/~bob/html/index.html or his cgi-bin directory. I followed the instructions on the Apache site. Is there another place in the /etc/httpd/conf/httpd.conf file that I need to modify?
%%%%
Excerpt from the /etc/httpd/conf/httpd.conf file
%%%%
#
<IfModule mod_userdir.c>
#
# UserDir is disabled by default since it can confirm the presence
# of a username on the system (depending on home directory
# permissions).
#
UserDir disable root
UserDir enable bob
#
# To enable requests to /~user/ to serve the user's public_html
# directory, remove the "UserDir disable" line above, and uncomment
# the following line instead:
#
UserDir html
</IfModule>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
#
# "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/home/*/html/cgi-bin">
Options ExecCGI
SetHandler cgi-script
</Directory>
#<Directory "/var/www/cgi-bin">
# AllowOverride None
# Options None
# Order allow,deny
# Allow from all
#</Directory>
Jman
2004-04-12, 06:10 AM CDT
Remove the UserDir disable root and UserDir enable bob lines. This is just specifies a directory for the user's public html directory.
If you want to check your config, run /sbin/service httpd configtest
See the Apache docs (http://httpd.apache.org/docs-2.0/mod/mod_userdir.html#userdir) for a complete reference.
Eli
2004-04-12, 06:50 AM CDT
A rainy day. Blah.
Well I did what you had recomended Jman, and the 'services' returned 'syntax okay' I also thought that it was a permission thing. So I 'chmod 755 *' in ~/bob/html/*. I did this recursively, and also on the html directory itself. But I still get.
403 Forbidden. From Apache.
Jman
2004-04-13, 05:36 PM CDT
Check the error logs. Look at the end of /var/log/httpd/error_log.
Eli
2004-04-13, 08:52 PM CDT
I am getting a permission error
[Tue Apr 13 22:37:33 2004] [notice] Apache/2.0.48 (Fedora) configured -- resuming normal operations
[Tue Apr 13 22:37:34 2004] [error] [client 127.0.0.1] (13)Permission denied: access to /~bob/html/index.html denied
[Tue Apr 13 22:42:17 2004] [error] [client 127.0.0.1] (13)Permission denied: access to /~bob/html/index.html denied
I am going to work on it tomorrow. I tried 'chgrp apache -R /home/bob/html' and I still am having no luck. I will read the documentation and see if there is anything I might have missed.
By the way, thanks for the tip to check the error logs. I was trying to look in /var/www/error/HTTP_UNAUTHORIZED.html.var
:o
goll
2005-01-21, 06:27 AM CST
Hi,
I have a similar problem. I can't get mod_userdir working
accessing to http://192.168.1.4/ works fine
accessing to http://192.168.1.4/~rolf/index.html says "Forbidden, You don't have permission to access /~rolf/index.html on this server"
The error_log says:
[Fri Jan 21 14:17:41 2005] [error] [client 192.168.1.202] (13)Permission denied: access to /~rolf/index.html denied
Here's an excerpt of httpd.conf
<IfModule mod_userdir.c>
UserDir enabled rolf
UserDir public_html
</IfModule>
<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
Order allow,deny
Allow from all
</Directory>
and here some other infos:
[root@thor html]# /sbin/service httpd configtest
Syntax OK
[root@thor html]# /etc/rc.d/init.d/httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[root@thor html]# l /home/rolf/
total 180
drwx------ 23 rolf users 4096 Jan 12 20:08 .
drwxr-xr-x 8 root root 4096 Jan 10 16:13 ..
[...]
drwxrwxr-x 8 rolf users 4096 Jan 3 09:44 public_html
[...]
[root@thor html]# l /home/rolf/public_html/index.html
-rw-r--r-- 1 rolf users 466 Jan 3 09:33 /home/rolf/public_html/index.html
SELinux is not activated (at least I think - how can I find this out?), so http://fedora.redhat.com/docs/selinux-apache-fc3/ doesn't apply here.
My system is basically an installation of FC3 out-of-the-box. I have only applied minor changes to the fresh install. I think, I've really tried everything.
Apache configuration has always been a pain for me :(
do you have any ideas?
Thanks
Rolf
jcpunk
2005-01-25, 01:17 PM CST
I am getting a permission error
[Tue Apr 13 22:37:33 2004] [notice] Apache/2.0.48 (Fedora) configured -- resuming normal operations
[Tue Apr 13 22:37:34 2004] [error] [client 127.0.0.1] (13)Permission denied: access to /~bob/html/index.html denied
[Tue Apr 13 22:42:17 2004] [error] [client 127.0.0.1] (13)Permission denied: access to /~bob/html/index.html denied
I am going to work on it tomorrow. I tried 'chgrp apache -R /home/bob/html' and I still am having no luck. I will read the documentation and see if there is anything I might have missed.
By the way, thanks for the tip to check the error logs. I was trying to look in /var/www/error/HTTP_UNAUTHORIZED.html.var
:o
perhaps I am missing something, but it seems to me that your filesystem looks like:
/home/bob/html/index.html
if this is correct you will never be able to access your web space at http://hostip/~bob/html/index.html
the ~bob part of the address is telling apache to enter the /home/bob/html folder, so unless your dir structure looks like /home/bob/html/html/index.html you are pointing towards a bogus directory and that would account for your 403 error.
try http://hostip/~bob/index.html
Adesso
2005-01-25, 01:41 PM CST
Just a idea... but would this not have to do with the fact that apache must be compiled with the --enable-pcntl option.. or am I way wrong.. ?
vBulletin® v3.8.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.