Since setting up my development environments on Mac OS X Lion (brand new macbook air purchased in January 2012), I have noticed that resolving to a virtual host is very slow (around 3 seconds) the first time but after that is fast as long as I continue loading it regularly.
If I leave it untouched for a couple of minutes and then reload again, the first reload is (again) painfully slow; seems like something is being cached.
As can be seen below I am not using the .local TLD.
My setup: Apache 2 - MySQL - PHP installed and enabled - added a couple of virtual hosts one of which I created for localhost
My /etc/hosts:
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
127.0.0.1 myproject.dev
::1 myproject.dev
fe80::1%lo0 myproject.dev
My virtual host set-up in username.conf:
NameVirtualHost *:80
<Directory "/Users/myusername/Sites/">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<VirtualHost *:80>
ServerName localhost
DocumentRoot /Users/myusername/Dropbox/dev_envs/
</VirtualHost>
<VirtualHost *:80>
ServerName myproject.dev
DocumentRoot /Users/myusername/Dropbox/dev_envs/myprojectname
</VirtualHost>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…