I decided to set up a local development server to help make my WordPress Theme development easier. Let’s just say it was a pain in the butt. I will record some of what I had trouble with. You can view the mountain of tuts and help sites that can guide you through the details. This is the site I followed, http://sixrevisions.com/tutorials/web-development-tutorials/using-xampp-for-local-wordpress-theme-development/.
I wanted to be able to work on multiple sites so I had to do some configuration. The first thing was to set up virtual directories for the sites I wanted to work with. I am using XAMPP for my server management and in this tool I stopped the Apache server. To setup up multiple sites in Apache I am using the virtual host configuration file. This file is located at [install directory]\apache\conf\extra\httpd-vhosts.conf. This took me a while to get this config right and it may not be optimal for your box, but here it is:
<VirtualHost *:80> ServerAdmin email@example.com #This is the path to your website files and they can be located anywhere on your drive DocumentRoot " C:/inetpub/wwwroot/yourdomain.com " ServerName yourdomain.com ServerAlias www. yourdomain.com ErrorLog "logs/ yourdomain.com -error.log" CustomLog "logs/ yourdomain.com -access.log" combined #I had to add this to get around 403 errors <Directory "C:/inetpub/wwwroot/yourdomain.com /"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Require all granted </Directory> </VirtualHost>
As you probably figured out yourdomain.com can be any domain you want: dev.yourdomain.com, google.com, mysite.net…
Next, I had to tell Windows to map the domain name to the local IP. This is done in the host file. You can probably find the host file at C:\Windows\System32\drivers\etc\hosts. The file does not have an extension and you should edit it in a simple text editor like Notepad. To configure the site I just added to Apache, I added:
After this was done for each site I wanted to configure I could access each one of them and develop locally without having to mess with the live production server.
If you have a problem starting Apache with a message stating that port 80 is unavailable you may need to stop IIS and Web Deployment Agent. In my situation, these were the services that had port 80 tied up for me.