In Mac OS X 10.9.3 I've Included http-vhosts in httpd.conf

# Virtual hosts
Include /private/etc/apache2/extra/httpd-vhosts.conf

I've commented out the DocumentRoot and the Directory in httpd.conf

# DocumentRoot "/Library/WebServer/Documents"
# <Directory "/Library/WebServer/Documents">...</Directory>

I've added the following to my httpd-vhosts.conf file

<VirtualHost *.80>
    DocumentRoot /Users/gdboling/Sites/rocket-gen
    ServerName local.rocket-gen.com
    <Directory "/Users/gdboling/Sites/rocket-gen">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all

And I've added the following to my /etc/hosts file    local.rocket-gen.com

I've restarted Apache

sudo apachectl restart

There is an index.html in that directory but when I access http://local.rocket-gen.com from the browser I get a 404. I am getting this in the error logs

[Tue Jun 17 19:09:10 2014] [error] [client] File does not exist: /usr/htdocs

I can't figure out why it is not working. If I create that directory as the DocumentRoot in httpd.conf it works. But I need to have several Virtual Hosts, so I'd like to get the vhosts file to work.

3 Answers 3


It looks like you have nearly everything correct. I'm running Mavericks with a couple dozen virtual hosts, so this should work for you.

First, and this might be all you need to do to fix things, you need to enclose your DocumentRoot in quotes. So,

DocumentRoot /Users/gdboling/Sites/rocket-gen


DocumentRoot "/Users/gdboling/Sites/rocket-gen"

Next, add the following to your /etc/hosts file, on the line immediately following what you already have. Your hosts file should be:

You have this part:    local.rocket-gen.com

Now add this right below:

::1     local.rocket-gen.com

I have each of my vhosts set in hosts this way.

  • 1
    The ::1 ... part is what I was missing. Commented Nov 19, 2015 at 3:43

Obviously, your apache cannot find its defined document root. In my opinion you mix some things up.

First, correct the typo within the VirtualHost container. You define addressing a port with a colon, not a "."

<VirtualHost *:80>...</VirtualHost>

Second, if you want to host multiple servers by name and not by IP address, you need to use name-based virtual hosts. Then of course in Apache configuration you missed the NameVirtualHost directive, if you want to set it up this way.

NameVirtualHost server1.example.org:80


ALWAYS set the ServerName, otherwise apache cannot chdir to your new documentroot.

Third, in the main httpd.conf configuration part you commented out the DocumentRoot. Did you also do this with the access rules in the "Directory /" section for your former DocumentRoot?

Fourth, if you want to set up hard VirtualHost instead of NameVirtualHost, do not forget the Listen directive. So for that you need a

Listen *:80

in your main httpd.conf. If you want to setup different servers on different IP addresses, you need to configure them like this:

  • add IP Address and resolvable name in /etc/hosts
  • add "Listen server1.example.com:80" in main httpd.conf
  • refer to your server instance like <VirtualHost server1.example.com:80>...
  • ALWAYS set the ServerName

This happened to me when I upgraded to Mavericks (10.9.5). Apple seems to have removed the “Web Sharing” from the “System Preferences” app, which was important to the way the http.conf file was written.

Two ways to fix it:

  1. Start apache with WEBSHARING_ON defined:

apachectl -k start -D WEBSHARING_ON

  1. Edit the http.conf file to remove <IfDefine WEBSHARING_ON> and corresponding </IfDefine>, BUT NOT the contents between the tags.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .