I'm trying to set up a virtual host on my Mac OS X 10.7 Installation. I'm using VirtualHostX to manage my /etc/hosts and httpd-vhosts.conf file. Currently, my httpd-vhosts.conf file looks like this:
NameVirtualHost *:80
<Directory "/Users/yuval/Sites/mysite/">
Allow From All
AllowOverride All
</Directory>
<VirtualHost *:80>
ServerName "mysite.dev"
DocumentRoot "/Users/yuval/Sites/mysite"
</VirtualHost>
and my /etc/hosts files has this in it:
# VHX START
127.0.0.1 mysite.dev
fe80::1%lo0 mysite.dev
# VHX STOP
I activated Web Sharing under System preferences, and I know apache is running. However, when I navigate to either 127.0.0.1 or to mysite.dev, I get the following:
Forbidden
You don't have permission to access / on this server.
My permissions on /Users/yuval/Sites/mysite are 755. Trying to change them to 777 didn't help either. Note that this is happening with any folder I choose -- I do not have an .htaccess file in /Users/yuval/Sites/mysite.
Update: Checking the apache error, these are the logs that appear:
[Fri Dec 09 17:59:27 2011] [error] [client 127.0.0.1] (13)Permission denied:
access to / denied
[Fri Dec 09 17:59:27 2011] [error] [client 127.0.0.1] (13)Permission denied:
access to /favicon.ico denied
It seems pretty obvious that the vhosts + hosts code is doing its job in actually determining that the address exists, but for some reason this isn't working. Any ideas?
Make sure an index.html
file is in the /Users/yuval/Sites/mysite/
directory.
OR enable directory indexing:
<Directory "/Users/yuval/Sites/mysite/">
Options +Indexes
Allow From All
AllowOverride All
</Directory>
You can also set the DirectoryIndex
option to look for default files other than index.html
: http://httpd.apache.org/docs/current/mod/mod_dir.html
Edit
Saw your error message - this doesn't look like a directory index problem.
Try chmod 755
on the /Users/yuval
directory as mentioned in this ServerFault answer: https://stackoverflow.com/a/1241319/212700
Also check for any .htaccess
files in the /Users/yuval/Sites/
directory as Apache will check those as well.