title: Apache VirtualHost slow lookup
body: <p>I finally managed how to configure properly httpd.conf for my virtualhost needings. This is the relevant part of httpd.conf file</p>
  
  <pre><code>NameVirtualHost *:80
  
  &lt;VirtualHost *:80&gt;
    ServerName localhost
    DocumentRoot /Applications/XAMPP/htdocs/
  &lt;/VirtualHost&gt;
  
  &lt;VirtualHost *:80&gt;
    ServerName test.local
    DocumentRoot /Applications/XAMPP/htdocs/test/
  &lt;/VirtualHost&gt;
  
  &lt;VirtualHost *:80&gt;
    ServerName work.local
    DocumentRoot /Applications/XAMPP/htdocs/work/
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>When I access anything on localhost (i.e. <a href="http://localhost/phpmyadmin">http://localhost/phpmyadmin</a>) everything is very fast.
  Whenever I access test.local or work.local (or others I configured) it spends 10-15 seconds on lookup. The following requests are handled correctly and it's very fast but after a minute or so of inactivity, it has to lookup again.</p>
  
  <p>This is my /etc/hosts file</p>
  
  <pre><code>127.0.0.1       localhost
  255.255.255.255 broadcasthost
  #::1             localhost
  fe80::1%lo0     localhost
  
  # Virtualhosts
  127.0.0.1       test.local     work.local    yii.local
  </code></pre>
  
  <p>How could I fix this annoying issue?</p>