PDA

View Full Version : 403 error when NamedVirtualHost is enabled



greg.harvey
5th May 2009, 09:03 AM
Hi all,

I've been working on this problem for a couple of days now. I have a clean installation of Fedora 10, installed Apache and all was fine. Checked out my various projects to /home/gharvey/workspace and created a vhosts entry to one of them that looks like this (after un-commenting the NamedVirtualHost line, of course):


<VirtualHost *:80>
ServerName drivingforce
DocumentRoot /home/gharvey/workspace/driving-force/trunk/www
ServerAdmin "webadmin@drupaler.co.uk"
<Directory /home/gharvey/workspace/driving-force/trunk/www>
Options Includes FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>

Made the appropriate entries, went to the site I got a 403. Checked the Linux permissions and made sure the entire workspace directory and contents were set to 755 - they are. Did some Googling and SELinux seemed the likely culprit, so I executed this command:


chcon -R unconfined_u:object_r:httpd_sys_content_t:s0 /home/gharvey/workspace

Nothing changed, still a 403.

Then I came across some stuff about the UserDir module and added this to the appropriate bit of httpd.conf:


<IfModule mod_userdir.c>

UserDir disabled
UserDir enabled gharvey
UserDir workspace

</IfModule>

This actually worked, but it makes the URL of my driving-force app in the vhosts entry like this:
http://localhost/~gharvey/driving-force/trunk/www/

Which is not the desired effect.

Someone suggested symlinking to the workspace directory from within /var/www/html on another thread, so I tried that (complete with updated vhost file to /var/www/html/workspace/) to no avail. Still a 403.

I'm running out of ideas! Can anyone tell me why this is going wrong? =(

Thanks in advance!


Edit: Actually, the title is misleading - NamedVirtualHost works fine - my localhost entry is ok (see below) - it's actually loading directories with /home that is the problem:


# This works:
<VirtualHost *:80>
ServerName localhost
DocumentRoot /var/www/html
ServerAdmin "webadmin@drupaler.co.uk"
<Directory /var/www/html>
Order allow,deny
Allow from all
Options Indexes SymLinksIfOwnerMatch IncludesNoExec
AllowOverride FileInfo AuthConfig Limit
</Directory>
</VirtualHost>

greg.harvey
5th May 2009, 10:20 AM
Actually, it now works. I blogged my ultimate solution here - please do let me know if I'm telling people wrong:
http://drupaler.co.uk/blog/apache2-fedora-getting-rid-403/418

greg.harvey
20th May 2009, 10:42 PM
An addition to the solution - simply but crucial:
http://forums.fedoraforum.org/showpost.php?p=966464&postcount=3