Advertisement

403 Forbidden on every page in Apache (chmod help?)

Started by April 02, 2007 10:16 AM
15 comments, last by Rhaythe 17 years, 7 months ago
I've just set up a CentOS 4.4 (basically Red Hat) box. I've set up the default Apache/mod_ssl packages that came with the distribution. I can set up name-based virtual hosts just fine inside /var/www/html (the default web root), but if I try to set one up in /home/*/public_html, I get a "403 Forbidden" error at every page. I figured this was because the Unix permissions on the folder were not permissive enough, so I simply ran "chmod -R 777 /home/thevhost/public_html", but that didn't help. Does chmod not do what I think it does (doesn't chmod 777 mean all permissions for everyone?), or is this likely a problem with my httpd.conf file? I've tried changing every instance of /var/www/html to /home/thevhost/public_html that I could find in the Apache configuration files (DocumentRoot, etc.), but it seemed to have no effect. Any ideas on what to try next? What could I add to the httpd.conf file that would guarantee access to the given folder? Edit: The error in Apache's log for the access denied is this: (13)Permission denied: access to / denied Doesn't error 13 mean it's an OS-level access denied to the file? How do I allow apache to see the contents of this directory? I even tried chown'ing the folder to the apache user, with no effect. [Edited by - BeanDog on April 2, 2007 10:34:05 AM]
It's possible that you have the directory indexes turned off. Are you trying to get actual files or just browse the directory?
Advertisement
No, I get the same error if I go to http://thevhostname/index.php or any other file directly.
in the <Directory> section add

Options indexes


Edit: oops, I guess that's not the problem then.
Did you install SELinux? If so, did you remember to poke a hole in that in order to allow it to execute?

On Red Hat, Weird Permissions Issues normally equals SELinux.
--- ---Current Project: http://source.dev-null-productions.com/tw/"Perhaps the most fundamental problem, however, is that INTJs really want people to make sense."
Assuming it's not a SELinux issue (which it very well could be) can you post the actual httpd.conf file?
Advertisement
SElinux is disabled.

OK, GameDev is acting funny when I try to post the httpd.conf here. So see my intended post text here.
OK, it's definitely Unix user permissions--when I change the User directive in the httpd.conf file to another user, it works fine.

What can I do to give the apache user permissions to a folder outside of /var/www?
chown -R apache:apache /path/to/target
--- ---Current Project: http://source.dev-null-productions.com/tw/"Perhaps the most fundamental problem, however, is that INTJs really want people to make sense."
Rhaythe, that's the first thing I tried. I just tried it again, and it had no effect.

To reiterate and clarity, here's my current situation:

If I set the User directive in httpd.conf to "vhostuser", then the vhost pointing to /home/vhostuser/public_html works fine.

If I set the User and Group directive in httpd.conf to "apache", then the vhost pointing to /home/vhostuser/public_html gives 403 Forbidden errors on every page.

If I chown /home/vhostuser/public_html to the apache user, it has no effect on the 403 errors.

The error shown in the error_log for apache is (13)Permission denied, which as I understand it is an OS-level file access denial.

It's like the apache user is somehow restricted to /var/www, even when it owns files and folders outside it. Any more ideas?

This topic is closed to new replies.

Advertisement