How To Setup a Home Web Server On Your Windows Computer With Apache [DIY]
A web server can be referred to either the hardware or the software that delivers content (webpages, documents, photos, files, videos etc), which can be accessed through the internet. A web server is what makes it possible to be able to access content e.g webpages, files from any computer, as long as it is connected to the internet and the server is also connected to the internet.
Disclaimer: Before we move on to the steps for creating a home web server on your computer, please be careful and proceed only when you know what you are doing. Running a web server on your computer might be very risky and if you’re not the type of person who knows how to tweak a network connection, assign a static IP address or port forward your Router preferences, you might not want to take the risk and install the home web server on your Windows computer. If possible, seek help from an expert who knows a thing or two regarding websites, Apache and stuff.
Before moving on, make sure you have thoroughly performed a complete system scan and that your computer is free from spyware, virus and trojans.
Things You Will Need
To set up a simple web server on your computer, you will need the following components:
1. A computer running Windows (Windows XP, Windows Vista or Windows 7).
2. Apache 2.2 installed on Windows.
3. Knowledge of tweaking your computer’s network preferences.
4. Knowledge of port forwarding the correct ports from your Router’s settings.
5. Mapping your computer’s IP address with a domain name.
6. An always “ON” internet connection, Broadband preferred.
Watch the Screencast
The following video tutorial illustrates all the steps required to install a home web server on your Windows computer. If you don’t like to follow all the written steps that follows next, just watch the following video tutorial and perform the actions as described.
Step 1: Assign a Static IP Address to Your Computer
For the home web server to function properly, you will need to assign a static IP address to your computer from Windows network and sharing center or control panel. This can be done manually but I recommend using portforward.com’s free tool for assigning static IP addresses to your computer, if you are not comfortable doing it manually. (related guide: find your computer’s IP address )
After assigning a static IP address, open windows command prompt and type ipconfig to see your computer’s IP configuration, which should look something like this
You are done with the IP settings, now it’s time to configure Apache.
Step 2: Configuring Apache On Windows – Installing the Home Server
1. First, disable Windows firewall completely before trying to install Apache on your computer. You should also close other applications, IM programs and other client side applications that may interfere with Apache’s working.
2. Download Apache 2.2 windows MSI installer and Install Apache 2.2 on your Windows computer. During installation enter the following credentials:
- Network domain: localhost
- Server Name: localhost
- Administrator’s email address: any email address of your choice
Remember to choose the selection “for all users, on port 80, as a service”.
3. When Apache has finished installing, open Windows Explorer, go to your computer’s hard drive and create a new folder where you would be hosting all the files of your website, hosted from your own computer. For the sake of this tutorial, let us assume that you create the root folder in E:\webserver.
4. Navigate to the Apache installation directory at C:\Program Files\Apache Software Foundation\Apache2.2\conf and open the httpd text file with Notepad or any other text editor of your choice.
4. Hit Control + F and do a search for DocumentRoot, switch to the second value and change it to the location of the folder you created in step 2.
5. Scroll down and find <Directory “C:\Program files\…”. Change the value to the location of the same custom folder you created in step 2.
6. Scroll down a bit and find Allow override. Change it’s value to All
7. Save the file as httpd.conf in the same directory. Remember to save as “All files” and not as a text document.
8. You are done configuring Apache on Windows for the home web server to function properly. Now right click the system tray icon and select “Restart all services”.
9. Next, point your browser to http://localhost and you should see the following screen
That means, Apache has been successfully installed on your computer and you are all set to deploy websites, files and other documents from your web server to the internet.
Step 3: Creating Directories and Files in your Home Web server
1. Go to your webserver’s root directory ( E:\webserver) and drop some sample files, folders. You will serve these files to your website visitors i.e you will allow people to download files from your computer via this home made web server.
2. You can create as many folders as you want and drop index.html files in each folder. These folders work the same way as any FTP directory, representing the folder and directory structure of a website. (related: hosting static websites )
3. When you are done creating the sample files and directories, refresh the localhost page and you should see the folder and file structure being updated. An example is shown below:
Step 4: Configuring Your Router For Port Forwarding
Open your web browser and type in 192.168.1.1 to access your Router’s preferences. In case the router asks for a password, enter the correct username and password combination ( 99% cases the combination is admin/admin)
Most wireless routers have a simple setup for port forwarding but in my case, the situation was slightly different. My Internet service provider is BSNL, Router is from Siemens and the Port forwarding page was hidden from the main navigation area.
In order to access the hidden port forwarding setup in LinkSys, Siemens or routers provided by BSNL (India) enter 192.168.1.1/main.html and it may open up your Router’s advanced settings page.
Click “Advanced setup” from the left sidebar and then choose NAT > DMZ Host. Next, enter your computer’s internal IP address under “DMZ Host IP address” and save the changes. You might need to restart/reboot the router for the changes to take effect.
If your router has a different setting, check out Portforward.com and learn how to port forward the “80” port from a specific router to the internet.
Step 5: Testing a Beta Run Of Your Home Web Server
Now that you have successfully port-forwarded your router or modem, it’s time to test your home web server and open a sample local website stored in your computer from any other computer you might have.
Go to whatsmyip.org to find out your computer’s external IP address. Once you have obtained the external IP of your computer, enter the same in the browser (of any computer) and your web server should show up.
Caution: Do not ask any random online friend to test your web server. Passing on your computer’s external IP address to anyone is not at all recommended. Careful !
Troubleshooting: If you are unable to open/test the web server because opening the external IP address keeps opening your router’s login page over and over again, use a proxy website like anonymouse.org
Once you have tested your home web server within your friends and a fewer group of people, it’s time to map the web server with a domain name.
Final Step: Mapping Your Web Server With a Domain Name
Passing out your computer’s or home server’s IP address to anyone can be risky. So what we will do now is register a free domain name at www.no-ip.com and map our home server’s external IP address with this domain name.
Once the domain mapping is in place, all you have to do is share the same domain name with your friends or with whoever you want to share the home server and it should work just as fine.
Visitors, friends or colleagues who have the address (or domain name) of your web server can browse through files, download them and use it the same way as they browse any other website on the internet. The only condition is that your computer must be connected to the internet and Apache should be installed and running as it normally should.
Turning Off The Home server
There are three ways to take your home server down, in case you’re down with it and want to switch off all the experiments:
1. Login to your No-Ip account and delete the hostname. Once the hostname is deleted, the domain name would notpoint back to your computer’s external IP address and visitors trying to access your server would get a “Time out error”
2. Change your computer’s internal as well as external IP address. Better still, assign a dynamic Ip address to your computer.
3. Uninstall Apache completely from the system and move all the server’s files to some other location.
Of all the above solutions, I would prefer the first option of deleting the hostname because it has the advantage of “plug and play” over it’s counterparts. Later, you can turn on the same web server by mapping another domain name to your computer’s external IP address.
Over To You
Have you ever experimented by creating a home web server on your windows, linux or MAC computers ? Tell us how you did it, what problems you faced and the outcomes in the comments below.
No one commented here. Wll, I will be first! :)
Thank you for the article!
Although for some reason I couldn’t figure out why I can’t connect from my public ip