I was messing around with virtual hosts and now I'm getting a 403 error when trying to access files on the webroot.
Here's my httpd-vhosts.conf:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName localhost
DocumentRoot /var/www
</VirtualHost>
<VirtualHost *:80>
ServerName test.ts
DocumentRoot /var/www/htdocs/vhost_test
<Directory /var/www/htdocs/vhost_test>
Options Indexes FollowSymLinks Includes
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
I'm pretty sure its a problem with vhosts because I commented out the line that included httpd-vhosts.conf on httpd.conf and the problem was gone. What's wrong with it?
EDIT: a day after Phil Hollenback helped me with this problem, the server began acting up again. Same problem as before, and doing what I did before didn't solve it this time. So I tried changing httpd-vhosts.conf with this:
<VirtualHost *:80>
ServerName localhost
DocumentRoot /var/www
<Directory /> #added this tag
Allow from all
<Directory>
</VirtualHost>
Now it's working.
Grep for DocumentRoot in your other conf files, like httpd.conf - is it defined anywhere outside of your vhosts? It's unclear from your question and the followups if your default DocumentRoot is actually in /var/www. You could have a different DocumentRoot pointing at an entirely different directory tree that's not /var/www - in which case changing permissions on /var/www won't affect anything.
Also when you say 'access files on the webroot' what do you mean exactly? How are you accessing the files?
Did you do
Make sure the user that apache is running as has permission to access /var/www
Hope that helps, RayQuang
Do you have a default document defined anywhere? If that's missing or doesn't include the filename you're using as your default a 403 is often returned.