Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Originally posted this over at superuser...

Ive configured Apache for Name-based Virtual Hosting but I can't seem to get a local site to show in my browser. Is my httpd.conf misconfigured? Here's the sanitized version:

# Use Name-based Virual Hosting.
NameVirtualHost *.:80

#Set up permissions for VirtualHosts in ~/Sites
<Directory "/Users/myusername/Sites">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all

# For http://localhost in the OSX default location
<VirtualHost _default_:80>
    ServerName localhost
    DocumentRoot /Library/WebServer/Documents

<VirtualHost *:80>
    ServerName thewebsite.local
    CustomLog "/Users/myusername/Sites/logs/thewebsite.local-access_log" combined
    ErrorLog "/Users/myusername/Sites/logs/thewebsite.local-error_log"
    DocumentRoot "/Users/myusername/Sites/thewebsite.local"

And my etc/hosts

# Host Database
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##       thewebsite.local       localhost broadcasthost
::1             localhost
fe80::1%lo0     localhost
share|improve this question

Apache searches the vhost list from top to bottom and will deliver content from the first virtual host that matches the host header or default whichever comes first. In your configuration the default virtual host is listed first so it's content gets delivered. Put your default site at the end or at least after sites whose content you want delivered.

The NameVirtualHost directive is usually NameVirtualHost *:80. It's generally not a great idea to use .local as it's use by mDNS etc and can get in the way.

share|improve this answer
When I change my .conf file it navigates to the /Library/WebServer/Documents folder now. – Ofeargall Dec 27 '11 at 0:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.