I always wanted to play with web servers and domain names. I often tried hosting websites from home server. After some research over internet i finally got a site hosted from my own home server. The internet connection i am using is 256 kbps from NTC adsl. My IP is dynamic that is it changes from time to time when i restart my router. And for router I am using Tplink W8901G. There were various places where i got confused but i finally got a site hosted at www.yalamber.co.cc (Not up right now as i kept the server down). Below is the detailed steps i followed. Hope you can catch up with it
Prepration
Find out your ip address. You can easily findout your ip address by going to www.whatismyip.com or www.whatismyip.com.np You will get your ip address from there. Note it down. This IP address changes from time to time when your router is restarted as this is your dynamic ip address that the ISP assigns to you. For the moment just note down the IP address. we will have use for it later. Go to zoneedit.com and register an account for free. Zoneedit.com offers free service up to 5 zones. i.e 5 domain names.
Get your server ready:
Install apache for your webserver. I have tested with apache only not any other server. If you don’t know about installing webservers I suggest using xampp from apache friends. setup your web server and go to http://localhost if you can see the page your server is ready. That part was easy wasn’t it?
Change apache to listen to alternative ports
Since ISP blocks default port 80 for web server we will have to configure apache to listen to other ports. I suggest trying 8080/5000. TO check if ports are blocked or not by your ISP go to www.canyouseeme.org check for port 8080/5000 they should not be blocked by your ISP.
Now, to add additional ports to let apache listen to go to your Apache’s conf folder. If you have used xampp and are on windows machine then go to C:\xampp\apache\conf (or where ever you have installed the xampp). Open up httpd.conf in your notepad or fav editor and find line
Listen 80
below that add
Listen 8080
Also look for
ServerName localhost:80
below it add
ServerName localhost:8080
Also go to C:\xampp\apache\conf\extra folder and open httpd-vhosts.conf file
find
NameVirtualHost *:80
below it add
NameVirtualHost *:80
I hope you understood what we are doing here we are just adding port 8080 to apache configuration to make it listen to port 8080
Then restart your webserver.
Now try opening http://localhost:8080 in your browser. You will see the same output as http://localhost
So port adding is achieved.
Configuring router
First get a static local ip for you computer. Find out your local ip, for that you can do ipconfig from command line. Your local IP and the Ip address we noted down before are different. The IP we got before was the IP assigned to us by our ISP and local IP is assigned to us by our router. Your local ip address may look like 192.168.1.2 Now to make it static.(instruction specific for TP link routers/ may or may not match other router) I first log in to my router control panel. It’s usually at http://192.168.1.1 for most of the router. Then I go to Interface Setup -> LAN . There you can see DHCP enabled and a list of connected computer with IP in DHCP table. In mac address column select your mac address and In status choose static. Also note down your local ip. Now you got your local ip address. Note that down too.
Now we need to forward the incoming request for IP assigned by our ISP that we noted down before to our this local ip address from our router. Go to Advanced setup->NAT in router and Select the virtual circuit you use. From there go to virtual server.
select application from the dropdown list to HTTP_Server
Protocol-> TCP
Start Port Number->8080
End Port Number->8080
Now save it. You have now successfully forwarded the incoming request at port 8080 to your webserver at local ip. Router configuration part is done
Assigning domain name to your server
You can assign domain name to your server now. For that you need to get a domain first. If you already have a domain you can change it’s name server to below address:
ns2.zoneedit.com
ns4.zoneedit.com
Since we will use zone edit for dns management. You can use free domain name .co.cc if you don’t want to mess with your precious domain name. co.cc provides free domain with dns management facility. After registration change your domains name server to above name servers provided.
After changing name servers go to zoneedit.com login with the username and password provided.
Go to Add Zone from header and add your domain name there.
You will get message as success or congratulations. Now click on start editing domain in real time below the success message then,
On Next page click on Ip address(A) on header.
In name field add ww2 and in next IP address field add your ip address. Not the local IP address here. The one we noted down at the first. Click on add new ip address and then,
Go to web forward option in header.
In the new domain field add www and in destination field add full url like this http://ww2.yourdomain.com:8080 . Here 8080 is the port number we used and the yourdomain.com is the domain name you want to get hosted. Now it’s done. we are doing web redirect or forward as because simply opening yourdomain.com won’t let us listen to port 80 as it is blocked.
Also as you may have dynamic Ip address. so you need software to automatically update your ip address to zoneedit.com. There is already made tool for that in this link http://www.zoneedit.com/doc/dynamic.html#faq3 I used zeDyn . If you can’t use that tool. you may have to manually update the ip address field at zoneedit.com when your ip address changes that is when your router restarts.
Now everything done. Try opening first your ip address. the one we noted at first with port number like 11.22.22.222:8080. if you can see your site your router is setuped correctly. Then try accessing www.yourdomain.com the domain you registered .You should see your site opening. You may have to wait for some hrs as the dns gets updated accross your dns server you are using. You can try accessing your sites through proxy or ask your friend if they can see it.
I hope this tutorial was helpful setting up your own server. Also your own home server may be slower due to slow connection. May have lot’s of downtime. But who cares we finally got our site up with our own home server.
Follow me up through comments.
very cool. good post. i personally would never host something from my home network, both from a security as well as speed perspective. but maybe that’s not the point
Yea I just wanted to host from home webserver
. I am very happy that it worked, would like to know if the site http://www.yalamber.co.cc opened at your end. Also i think you posted about that old laptop for sale at sodne.com. Is it still available? Didn’t knw you posted reply as i didn’t got any notification.