Add to Favourites Add to Favourites    Print this Article Print this Article

I'm seeing a lot of localhost VHost entires on my server-status page

If you've enabled the server-status tool in apache, you may see many entries that look like this:

37-0 - 0/0/9   . 0.00 24325 0   0.0 0.00 0.18 1.2.3.4 localhost NULL
39-0 - 0/0/8   . 0.00 24324 65  0.0 0.00 0.15 2.3.4.5 localhost NULL
40-0 - 0/0/15  . 0.00 24306 179 0.0 0.00 0.34 3.4.5.6 localhost NULL
41-0 - 0/0/110 . 1.10 23858 48  0.0 0.00 0.54 4.5.6.7 localhost NULL

Many new browsers will pre-connect to Apache.  When a client browses your websites, it's logical to assume that a client will click a link on that website.  When that happens the browser needs to connect to your server again to make this new request.  Newer browsers (such as Chrome) will pre-connect to a server.

After the client loads his first page, knowing that the client will likely click a link, the browser will connect to your server before the client has clicked anything.  For these cases, no request has yet been made... it's just an empty, idle connection without any communication over it yet (until a click happens).

Since the "Host" header has not yet been sent, Apache won't know which VirtualHost to send the request to, so it defaults to the very first VirtualHost on that IP, which in this case, is in /etc/httpd/conf/httpd-vhosts.conf, as it uses a ServerName of "localhost", since nothing specific seems approriate. (it could also be in the /etc/httpd/conf/ips.conf for a shared IP)

Was this answer helpful?

Also Read