Hosting A Website In XAMPP

XAMPP is a “free and open source cross-platform web server solution package” that makes it very easy to create a web server on your local machine. It is available for various Unix flavors, and for Windows, which is the version we will look at in this article.

Installing and running Xampp

xampp control panel Installing Xampp is a straightforward process.(Link to: XAMPP for windows) You just download the executable file and run it. All you need to do is specify where you want Xampp to install. If you accept the default installation, Xampp will install an Apache server, PHP, MySQL and PHPMyAdmin on your computer.

Before you can run the Apache server, you will need to make two small changes to the configuration. The default port that Xampp installs is port 80, and you need to change this to another value, for example 8000. Use a text editor to open the file c:\xampp\apache\conf\httpd.conf. Locate the line Listen 80 and change it to Listen 8000. Next, locate the line ServerName localhost:80 and change the 80 to 8000. Save the file.

In the Xampp root folder, there will be a file named xampp-control.exe. Double click this to open the control screen. Click the Start button for the Apache server. In your browser address bar, type in http://localhost:8000/ and you should see a message congratulating you on your successful installation.

Testing your website

Set up a folder, let’s say “” in c:\xampp\htdocs, so you now have c:\xampp\htdocs\ Copy all your web pages in here. Assuming you have an index.html file in the folder, typing http://localhost:8000/ in your browser will bring up your home page.

Going public

This is where it gets tricky. You will need your ISP allocated IP address, and the IP address, username and password for your router. Access your router by typing its IP address into your browser. You have to unblock port 8000, and how you do so depends on what router you are using. Next, go back to edit httpd.conf and change ServerName localhost:8000, replacing localhost with your IP address.

Problems using your local XAMPP for hosting your websites

You now know the basics of how to host website in xampp, but setting up your machine as a web server is fraught with problems. These are just some things to be aware of:

  1. Security is a prime concern, since you are letting the whole world access your computer.
  2. The outside world has to access your site using your IP address, unless you pay for a domain name to be associated with it.
  3. ISPs often allocate different IP addresses each time you login. Every time that happens your website will be unavailable until you reconfigure.
  4. Data, images, files etc. must be uploaded from your computer. Most ISPs are optimized for downloading, and upload speeds are very, very slow.
  5. You have to leave your PC on all the time. When your PC is down, so is your website.

The cost of running your PC 24/7, of associating a domain name with your IP address, and of putting backups in place will probably exceed the cost of using a hosting service. The time you spend poring over logs, and checking that everything is running fine may not justify the savings of having your own web server.