Tell me more ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've set up a few virtual hosts in Lion and it's running very slowly.

NameVirtualHost *:80 

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

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

then in /etc/hosts I added 127.0.0.1 dev.local

Everything works fine but it's sooooo slow — 5 or so second to reload a simple "Hello World" html page.

Here's is the strange part. If I make a symbolic link of the site in my ~/Sites folder (ln -s ~/mysite ~/Sites/mysite) and navigate to http://localhost/~me/mysite It's nice and fast the way it should be.

share|improve this question

closed as off topic by SvW, MDMarra, kce, mgorven, Dave M Jul 8 '12 at 20:57

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

2 Answers

Do you mean /etc/hosts instead of /etc/local ?

The 5 second delay sounds like something I see when there is DNS trouble. Perhaps your primary DNS is not responding and the 5 seconds is the time out it takes to fall over to the secondary.

From the command line what do you get for

host -a lp.local

In any case your DNS server is not gong to know about lp.local is it?

share|improve this answer
Trying "dev.local" Received 30 bytes from 10.0.1.1#53 in 2 ms Trying "dev.local..." Host dev.local not found: 3(NXDOMAIN) Received 50 bytes from 10.0.1.1#53 in 32 ms – jwerre Jul 5 '12 at 22:09

So apparently I don't have enough reputation to respond to your comment to my earlier answer, so I am posting this as a new answer.

It appears you edited your question since my earlier reply. You are now indicating that the file you edited was /etc/hosts rather than /etc/local and you are indicating that the host name is dev.local rather than lp.local.

I think you are swimming upstream here un-necessarily.

Your mac already has a .local address. Is there any reason you are not using that one? When you open your sharing preference pane what does it say is the .local address of your machine? So long as that address and the address in you http.conf file match you should be set. You should not need to make an entry in the /etc/hosts file as bonjour will already have taken care of this routing for you.

share|improve this answer

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