Intresting Stuff : Turn your local desktop to a webserver

Lets try some cool networking stuff. How about establishing a private hosting server on your local machine. In this post, we will be discussing about how to make your localhost accessible from public network. That is pretty much like having your own web server. Generally the basic requirements for establishing web servers are very high speed computer with very good internet connection (high uplink) and a static IP address. However none of these mentioned requirements can prevent you from establishing a temporary webserver. You can get one right on your desktop.
Get Set Go. Firstly your computer should be accessible or visible from public network. Normally for security reasons, firewall prevents you from being visible to outer world (public network). For being visible from public network, you should get a port forwarded from your router to your computer's private IP. The procedure of Port forwarding can be different as per the brand of routers. But you have nothing to worry about, some good people around have made port forwarding a lot easier. They have collection of instructions for port forwarding on different variety of routers. You can easily find yours on the site. But before forwarding a port, try to be on safe side, find a safe port that no other application is currently using. That safe port is generally number above 1024.
Now after port forwarding, you need a webserver that handles the request from client. As for the server, We are using apache server. You can get a free version of Apache server on internet. Here we are using XAMPP. You can get a free copy for the link and get it installed. If you are on linux machine, get LAMP instead. After XAMPP/LAMP server is installed, you are just one step away from your webserver. Make the server listen to the port you have forwarded initially. For that navigate to the xampp folder, default location would be on c:/ drive (Windows) then enter apache and goto conf folder. There you should find httpd.conf file. Open that file in any text editor and search for "Listen 80".

Now right below that line of code add "Listen *:yourport". Replace yourport with the port number you have forwarded earlier.

And you are ready to go. Now quickly get your public IP. Now copy that public ip and add colon and your port and paste it to browser. (If you IP is and you have 3535 port forwarded then visit and you should see some webpage hosted on your computer). You can share the address with friends on different public IP and show content hosted on your computer.

No comments :

Post a Comment