Home > How To > How To Make Your Computer/PC A Web Server

How To Make Your Computer/PC A Web Server

We access many websites daily related to file hosting, mail, games and many more. Have you ever wondered how those websites run? How do these websites provide you lots of information. Answer is simple, all these websites have their web severs through which we access them. Now question is, what is a Web Server? A Web Sever is a program that allows the access of files stored on a computer to another computer over the internet. How about creating your own web server?

There are many reasons to create your own web server. For example: file sharing, so that you can download files from your home computer from anywhere or you can create a web site on your own server etc. Simply said, It works like this; You choose a directory on your computer, in that directory add folders, files like music, video etc. When you put the IP address of your computer the in web browser you can see all the files from that folder and you can download those files.

Let’s see how to create a server(HTTP server) using Apache(a server client).

What We Need:

  • Broadband Internet connection always on.
  • Computer with Windows installed on it.

Procedure:

Step 1

First create a folder in any of the Disk Drives on your computer and name it as MyServer, or you can give any other name just make sure you remember it. Note down the path of this folder, in my case it is “E:\MyServer“. Copy here the files and folders that you want to be available online.

You can also put your website here. Or you can create an HTML page that shows the links to your files, music or videos etc.

Step 2

Now download apache server client and install it on your PC. You can download apache2.2.10- win32-x86-nossl.msi from here. Set parameters, for localhost type something like myserver.com (doesn’t really matter), also type your email address in field Administrator@ Email Address as shown below, choose where you want to install it.

How To Make Your Computer A Web Server - install apache http server

Step 3

After you have installed Apache server client, go to directory where you installed it (i.e. C:\Program Files\Apache Software Foundation\Apache2.2conf), here you will find an httpd file. First you have to take ownership of httpd.conf file otherwise it will not allow you to save changes to itself. Click here to know how to take ownership of any file.
After taking ownership of httpd.conf file, open it with notepad.

httpd-location

Step 4

After this notepad will appear with long and complicated code, don´t worry, you must change just 3 things.
First, in notepad file find  #DocumentRoot “C:/Program Files/Apache Group/Apache2/htdocs” and replace with #DocumentRoot “E:\MyServer”.
Then find <Directory “C:/Program Files/Apache Group/Apache2/htdocs”> and replace with <Directory E:\MyServer>.
E:\MyServer is the folder where you put files which will appear on your server. In this example I created that folder on local disc E: .
Now find #AllowOverride None and change to AllowOverride All.

Now press Ctrl + S  to save changes to file. Close the notepad.

Step 5

Now, your web server is ready. You can test it. Type http://localhost/ web address or your IP Address in your web browser’s address bar, you should see something like this.

If you see page like the one shown above, you have successfully created the web server. If you don’t see page like the one shown above, please check the settings and try again.

Step 6

If you want to access your own server from other computers via internet, you must forward a port in the router you’re using. The port we need to forward is port number 80. Why? Because by default it’s the port used for HTTP protocol. Port forwarding actually means opening a tunnel through the router so that the router wouldn’t reject the connections that are trying to connect to it. How to port-forward? With every router it’s different. Here are the instructions for every one of them. You must also turn off you firewall or allow Apache server program through your firewall.

Once you have forwarded HTTP port in your router, you can access your web server over the internet. This time you have to put your WAN IP in the address bar of your web browser instead of “http://localhost/” or LAN IP.

How to find your WAN IP? You can easily find your WAN IP in your router’s settings or simply type “what is my ip” in Google and it will show your WAN IP. Make sure you have availed FIXED IP service as your WAN IP keeps changing.

Enjoy your web server! Now you can access your computer from anywhere. Should you face a problem, feel free to leave comment below.

One comment

  1. Thanks you great and go on teaching us!!

Leave a Reply

Your email address will not be published. Required fields are marked *