I am trying to set up an Apache vhost on Mavericks, something that I was able to do easily on 10.6.8. I am using the default Apache that is preinstalled on a fresh install of OS X 10.9.2
$ sudo apachectl start
org.apache.httpd: Already loaded
$ ping localhost
PING localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.053 ms
But when I navigate to either http://localhost
or http://127.0.0.1
on any of my 3 browsers, I'm told I can't connect, instead of seeing Apache's "It Works!" message. (On Chrome I see "Oops! Google Chrome could not connect to localhost")
I also tried adding a vhost:
- Uncommented
Include /etc/apache2/extra/httpd-vhosts.conf
in /private/var/appache2/httpd.conf - Added
127.0.0.1 test.local
to /etc/hosts Added the following to /etc/apache2/extra/http2-vhosts.conf
<VirtualHost *:80> ServerName test.local DocumentRoot /Users/me/test <Directory /Users/me/test> AllowOverride all Options -MultiViews </Directory> </VirtualHost>
Restarted Apache
$ apachectl -t Syntax OK $ sudo apachectl graceful $ ping test.local PING test.local (127.0.0.1): 56 data bytes 64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.040 ms
...but again, nothing when I navigate to http://test.local
Any thoughts? Does this have something to do with Mavericks' new "Web Sharing" preference, which you have to download separately, or something?
Edit:
Figured it out! I had to modify the main httpd.conf Directory options to AllowOverride All
and Allow from All
, as per this tutorial. The conf file that comes with Mavericks has this turned off. If I had looked at my original conf file on my old machine, I would have noticed the difference.
The other thing that was messing me up is that if I have
ErrorLog "/Users/me/error.log"
in my VirtualHost definition, I get "Chrome can't connect", even though Apache tells me the syntax is fine. Removing it resolves the problem.
Thanks all!