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

I've finally made the switch to Lion but I'm having trouble setting up an Apache VirtualHost. This is what I've done so far and I'm not sure why it's not working.

1) In /etc/apache2/httpd.conf I uncommented this this line:

Include /private/etc/apache2/extra/httpd-vhosts.conf

2) In the httpd-vhosts.conf I put this:

NameVirtualHost *:80    

<VirtualHost *:80>
    ServerName localhost
    DocumentRoot "/Library/WebServer/Documents"

<VirtualHost *:80>
    ServerName work.local
    DocumentRoot "/Users/me/Work"
    <Directory /Users/me/Work>
        Order allow,deny
        Allow from all

3) Then I created an index.html in ~/Work

4) Finally I sudo apachectl restart ( I also restart it from Sharing in Sys Preference )

...but when I go to work.local it can't find it nor I can ping it.

$ ping work.local
ping: cannot resolve work.local: Unknown host

$ apachectl -S
httpd: Could not reliably determine the server's fully qualified domain name, using me-iMac.local for ServerName
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80                   is a NameVirtualHost
         default server localhost (/etc/apache2/other/httpd-vhosts.conf:17)
         port 80 namevhost localhost (/etc/apache2/other/httpd-vhosts.conf:17)
Syntax OK
share|improve this question
up vote 0 down vote accepted

$ ping work.local

ping: cannot resolve work.local: Unknown host

The system does not the the IP of work.local

add work.local as hostname in /etc/hosts

see evt. this for dsn on lion

share|improve this answer
That did it. Thanks! – Pardoner Feb 3 '12 at 4:50

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.