How to get a virtual host to work in OS X Lion? How to get a virtual host to work in OS X Lion? apache apache

How to get a virtual host to work in OS X Lion?


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.


The only thing I had to do was re-point to my custom vhost directory (and restart apache.)

I tried to point to ~/Sites/vhosts instead of /Users/[Username]/Sites/vhosts where I keep all my .conf files, so there was a configuration error. I was looking for the apache logs and learned from the apache docs about httpd -S which told me exactly where the configuration problems were.

Lots of misinformation in blogs on the net so Im posting this here for apache noobs like me.

httpd -S# fix the issuessudo apachectl restart