Installing XAMPP
Download XAMPP Installer for WIndows and install with default settings.
If you get a warning in XAMPP saying Skype is using port 80, do the following:
- Stop all services and quit XAMPP
- Open Skype
- Tools -> Options -> Advanced settings -> Connection
- Uncheck “Use port 80 and 443 as alternatives”
- Run XAMPP as administrator
Setting up virtual hosts
- Stop all services in XAMPP
- Open Apache
vhostsfile located at:C:\xampp\apache\conf\extra\httpd-vhosts.conf - First add a default virtual host buy adding the following code to the end of the file
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>
This will stop the URL http://localhost/ from redirecting to the first real virtual host we create. This is handy when you need to access a URL like http://localhost/newsite/wp/wp-admin to install WordPress etc.
- Next follow the examples in the
vhostsfile and add this code to the end of the file after our default virtual host.
<VirtualHost *:80>
ServerAdmin postmaster@bp.benpearson
DocumentRoot "C:/xampp/htdocs/benpearson"
ServerName bp.benpearson
ServerAlias www.bp.benpearson
ErrorLog "logs/bp.benpearson-error.log"
CustomLog "logs/bp.benpearson-access.log" combined
</VirtualHost>
This code will create a virtual host for bp.benpearson
- Create the folder
C:/xampp/htdocs/benpearsonand put a testindex.htmlin there. - Run notepad as an administrator
- Open the Windows
hostsfile located at:C:\Windows\System32\drivers\etc\hosts(may need to select “All Files” to see thehostsfile in theetcdirectory) - Add the following line to the bottom of the file (the space after the IP address should be a tab) :
127.0.0.1 bp.benpearson
- Start XAMPP Apache service.
- Go to
bp.benpearsonin a browser and you should see your testindex.html.
Reference: How to set up XAMPP with virtual hosts (some instructions conflict with the above)