Virtual Host Bloat Causes Apache To Burp

Testing a local install of WordPress was a nightmare. It felt like I was using a dial-up connection. The crazy thing was I was testing locally and the whole benefit of testing locally is you don’t have to rely on the speed of the Internet. It’s supposed to be lightening fast.

Why the heck was it so slow? Well, I read this article (and several others) and it looked like my Virtual Hosts were slowing things down. I went into my hosts file:

[prettify]
C:\Windows\System32\drivers\etc\hosts
[/prettify]

And commented out all the virtual hosts I was using.

[prettify]
127.0.0.1 localhost
#127.0.0.1 wp-test.kingluddite.com
#::1 localhost
#127.0.0.1 bhs.org.local
#127.0.0.1 dev.oceancharterschool.org
#127.0.0.1 wordpress-wednesday.com
#127.0.0.1 dev-wordpress.oceancharterschool.org
[/prettify]

The local wordpress install I am messing with is located inside the htdocs folder. I guess the lesson learned is don’t overdose on Virtual hosts or you’ll be slowed down tremendously when your testing locally.

Screencast: Virtual Host with PCs

Setting up a Virtual Host is confusing at first. It has driven me batty many times. I think I have collected enough info here for you to not have as many problems as I have had.

Here is the post I originally did after reading this great article.

To give you a visual how it works, check out the following screencast I did:

Here are some useful pieces of info from the video:

Where is my ‘hosts’ file?
C:\windows\system32\drivers\etc\hosts

Add this to the bottom of the file:
127.0.0.1 wordpress-wednesdays.com

If you don’t see the ‘hosts’ file read the following article
http://www.bleepingcomputer.com/tutorials/how-to-see-hidden-files-in-windows/

Where is the Apache config file?
C:\xampp\apache\conf\extra\httpd-vhosts.conf

Add to the bottom of this file:

Note: replace the following configuration with the info relative to how you have your files set up:

Some helpful hints:

  • DocumentRoot “C:\xampp\htdocs” – is this where your server root it? (note: it’s the default server root for a XAMPP install)
  • ServerName wordpress-wednesday.com – This should match exactly what you entered into the hosts file
  • DocumentRoot “C:\xampp\htdocs\wordpress-wednesday” – This and the Directory should match the absolute paths to where you site is on your local machine

[prettify]NameVirtualHost *

DocumentRoot “C:\xampp\htdocs”
ServerName localhost


DocumentRoot “C:\xampp\htdocs\wordpress-wednesday”
ServerName wordpress-wednesday.com

Order allow,deny
Allow from all


[/prettify]

I hope it helps. Let me know if you have any questions or can offer an improvements on the method I used.