How to Host PHP Websites at your Home Computer?

Hosting PHP Website at home has its own security risks but it is not difficult as most of you think. To host a Website you need IP address(Dynamic or Static) which you already have because you are reading this blog and Server Software like Apache or IIS and domain name.If you are using PHP and MySQL at your home computer then your computer has server installed which is either Apache or IIS. If some of you don't then should first install it from wamp.

1. Make sure that your computer has Server  Software Installed :

Download Wamp(Wamp is for windows , Lamp is for Linux) according to your Operating System(Linux , Windows or MAC) from this website. Install it and move your php files into root folder of wamp which is usually www , if your server software is different than it would be htdocs.

Now,as you moved all your files to the root folder of Apache Server ,check whether your server is working or not, by typing localhost/your_folder_name/file_name.php into the address bar of your browser. If you get the expected output then everything is working fine and you can move to step 2.

2.Hosting server needs Static Ip address , if you have that then move to step 3 , if you don't have static ip address or don't even know the meaning of ip then read this step :

Whenever one computer connects with another computer on any network it needs a unique address like we need home address to get our letters, this address is called IP (Internet Protocol) Address which is like Whenever we connect to the internet , our Internet Service Provider allots IP address to our computer from a range of IP Addresses ,this type of allotment is called dynamic if it changes whenever we reconnect our internet and the similar address is called static when it doesn't change irrespective of our connecting or disconnecting.

Static cost us more price than dynamic and usually common user don't need static ip at all.

If you don't have static ip , I assume you don't then you should try searching some good dynamic dns web service on google , which would provide you service for free to use your existing dynamic address to host website.

3. If you are using broadband as I do then you need to change factory settings of your modem , so that it can forward any request on port 80 to your localhost wamp server.

There are many ways to do so, each vary with different modems but generally you should type in your address bar which opens up your modem control panel. If it asks for username and password and you don't know them, just type admin as username and password both(It usually works). After that click on Add NAT which is in Advanced Setting Tab of your modem home page. In NAT, write 80 for both UDP and TCP  in there respective boxes. 80 is a Port number which is used for Web Services like http requests. Select both TCP and UDP as your packet types and in IP address, type your computer's ip address which you can find using ipconfig in command prompt.
4. Add Exception to all of your firewalls so that they allow any request from port 80 on your computer.You can find windows firewall in Control Panel.

5. Congratulations ! You have done it. I know there is still large scope of improvement for this article but it is a vast topic and I tried my best to make it as compact as possible.Moreover , I will keep improving it according to your suggestion and comments. Bye for Now.

No comments:

Post a Comment