Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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>

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

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

1 Answer 1

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 http://www.justincarmony.com/blog/2011/07/27/mac-os-x-lion-etc-hosts-bugs-and-dns-resolution/

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

Your Answer

 
discard

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.