For beginners out there, here is a simple guide for you to run Apache 2 web server locally on your Windows machine. Running a web server locally means that you will give your machine a local, imaginary domain name such as www.yourmachine.com or www.ihavemyownwebserver.com.
A local web server can serve web pages as a live web server, but it is restricted to machines from your local area network. A local web server can’t server web pages to users on the Internet – you need to buy a proper domain name and a live web hosting service for that to work.
Advantages of a Local Web Server
It is free to use – you don’t have to buy anything to have a local web server. You don’t need to have a live Internet connection to run it too!
Great for testing out products – you can test many web applications with a local web server. You can run WordPress, ActiveCollab and more!
Enjoy the same web server experience – running a local web server does not differ much from running a live one. The only difference is that your web server will only be available on your LAN.
Step by Step Installation of Apache 2 Web Server on Windows
I tested this on my machine that runs Microsoft Windows 2000 Professional. Windows XP users should have no problem using this guide.
1- Open up your “hosts” file with a Notepad. On Win2K, it is located at C:\WINNT\System32\drivers\etc. On WinXP it is located at C:\Windows\System32\drivers\etc.
2- Check out the line that starts with 127.0.0.1. Add your imaginary web server name at the end of the line. Put something like www.syahid.com or www.mywebserver.com. Save your “hosts” file.
A “hosts” file is used to map your IP address to a server name. In this case, 127.0.0.1 equals the web server name of your choice.
Example hosts file line: 127.0.0.1 localhost syahid www.syahid.com
3- Click your Windows Start button. Click on “Run“. Type “cmd” and click Enter. A DOS command prompt will appear.
4- Type “ping www.syahid.com” or whatever name you give your web server before. Your machine should give a reply as shown in the picture below.
Download and Install Apache Web Server
5- Go to Apache 2 download page. Always download the latest stable version. During the time of this installation, the recent stable version of Apache 2 for Windows installer (.msi file) is 2.2.4. Download this file to your Desktop.
6- Right click on the the installer file, select “Install“. Accept the agreement and click Next. Click Next once more.
7- Fill in your web server information details as shown in the screenshot below.
For example, if your server name is www.syahid.com, here is what you fill in in the fields:
- Network name : syahid.com
- Server name : www.syahid.com
- Administrator’s name: <leave this as default>
Click Next again.
8- Select “Typical Install“. Click Next.
9- Accept the default installation path – C:\Program Files\Apache Software Foundation\Apache2.2\ , or change it according to your preferences. Click Next to proceed.
10- Wait until the installation is over, then click Next once more and click Finish to wrap up the installation process. Apache will starts automatically and you can see a “green Apache icon” on your taskbar.
Test Apache Web Server Installation
11- Click on the icon as shown above, click “Open Apache Monitor“. Try to Stop, Start and Restart the web server service from the Apache Monitor console. Make sure every step is successful.
12- Open up your browser. Type in your web server address, e.g http://www.syahid.com . If there is no problem with your installation, you shall get the “It works!” page.
Your Apache 2 web server installation is a success! Congratulations! Now you can fill in your web server directory with all your HTML files. Your default web directory page will be C:\Program Files\Apache Software Foundation\Apache2.2\htdocs .
That was easy! Maybe next time I will show you on how to integrate support for PHP and MySQL into this installation. So don’t forget to check out this site soon!