Sunday 7 August 2011

How to Create a Free Web Hosting in Your Home? (2)

(For the latest PDF files Merger Software please have a look at the top of the left margin, inside the red box.) Next you need to test your IP address on the Internet. (Please also read the previous post.)This is different with your private hub IP addresses. It is the unique address given by your broadband service provider to the location of your router on the entire Internet.You can get it on different places.
For example, log into your router and click on "Basic Setup" you find it as

It is something like "98.227.112.49" This number is as good and working as any important site such as www.un.org or other sites. Ask a friend to type that IP address in their browser and voila! He will be directed to your hand-made web site. Remember from the previous post that if your default home page is not "index.htm" you have to configure "httpd.conf" file accordingly, or type "http://98.227.112.49/home.html". You have a web hosting of your own free. This IP address is subject to arbitrary change by the provider. It is dynamic for ease of maintenance. People join to and opt out from a provider and their address will be given to others. You also may change the provider or your residential. It also cannot be remembered easily. It needs a mnemonic to help to memorise. There are companies on the Internet that provide you with a free client software for maintaining a constant connection of the Internet with your potentially changable IP through a mnemonic of your choice. These companies are called "Dynamic DNS Provider" or such. You can use your favourit search engine to find one. By client I mean the old PC that is being used for your in-the-home web hosting. It is necessary that you subscribe to such a free service. Then download and install the client software on the "client" following their simple instructions. This mnemonic is not a top level domain such as www.anexample.org. It is a subdomain such as "subexample.anexample.org" Mine is messiah.dyndns.inf. I got dyndns.inf from free DynDns' many available options. I mention their name as a gratitude to the free service. If you like to have a top domain name, then you have to buy one by paying £5 ($8) (at the time of writing this article) a year. Many of more attracting names are being used by others or are bought to be kept to sell for higher prices. After purchasing that domain name or if you already have one, then you can redirect your top domain name through that dynamic IP provider to your home made web site.  dynamic IP provider tells you how you should do that. (freedns.afraid.org starts by default from a top domain name of yours. Their dynamic DNS service is also free. With £5 ($8) a year (at the time of writing this article) you buy a domain name from any seller and then redirect it through dynamic dns and nameservers of freedns.afraid.org to your home web server.) You should follow guidelines to maintain your down-time to minimum per year. It is easy to surpass in quality over an expensive web hosting if you minimise load of that web server machine. Do not use it for other purposes and do not put more than the minimum of operating system software on it. Uninstall additional software (sometimes called bloat-ware) that comes with an operating system and has not any use for your web server. It is possible to gain an old PC with an OEM Windows XP installed under £20 ($30) or sometimes drastically less than that on the eBay now a days. You can upgrade it to a 3GHz CPU, 3GB RAM. The bad thing about a desktop PC is its electricity consumption and noise that it creates. Bad thing about old laptops is that you cannot upgrade its cpu easily and old laptops normally cannot accept  more than 1GB of RAM. By the end of 2012 Britain will be the first country that all its communication network will be on the Internet. There will remain no conventional telephon switching after that. Thanks to optical fiber on your door, speed of connections are not subject to trafic load and distance and is constant all around the clock. Hosting at home is the next asset that you can have besides being just consumers of  the other web sites. At the end this is very pleasing job to accomplish. It is fulfilling like ham radio and DXing, when you were producer of your own equipments instead of buying them. After preliminary set up of the site, there'll be many Elmer's notebooks on the Internet that paves the way towards full professionalism. For example, click on this link, http://messiah.dyndns.info/CodesForUs.html. You can find that I have moved part of this blog on into that web site at my home. (Thanks to Grant Hardy who edited this post from the US)
(Update : See also this post Web Hosting at Your Home (Revisited) )
Update, 25 March 2014 : You might find these two wikis useful, too.
They include images and are step-by-step.

Moving from Microsoft Office Live Web Hosting (3): How to Create a Free Web Hosting in Your Home (1)?

(For the latest PDF files Merger Software please have a look at the top of the left margin, inside the red box.) If you are on a broadband and have an old computer or laptop and have a taste of hobbyist tinkerers jobs, you might be eager to become your own host for your website. (This is a continuation of two previous posts in moving from OL.) That could become more powerful than a purchased hosting. You need to download the Apache http Server which is a free software (GPL compatible) for serving your website to public. Install Apache server on your old PC. Well, my platform is a Windows XP Professional SP3. I have not tested that on a Unix yet. I'll do it and update this blog. I double click on downloaded software (it is Microsoft Installer file format, .msi). After some routine procedures, this dialogue asks me for some information.

Information I put could be arbitrary. Later, I can configure them if I like. Next I select a custom install.

I have an Apache home directory already in my computer as "C:\JavaHome\ Apache Software Foundation" inside my Java home directory. I change the default of http server to this directory, as "C:\JavaHome\ Apache Software Foundation\Apache2.2"

Yours also could be any directory of your choice. After finishing installation, an "Apache Server Icon" appears on the quick launch tray of your desktop. Inside the Apache2.2 folder there are other folders. Please open "htdocs" folder and double click "index.html" it opens in your default browser showing "It works!" as the sign of success in correct installation of Apache http server. Next to "htdocs" you may notice the "conf" folder. Please open the directory to find the "httpd.conf" file inside it. Add a ".txt" extension to its name (i.e., httpd.conf.txt) to be able to edit the file in a notepad. (Frequently I open many of such files in NetBeans IDE). Find this line inside the document (it is line 179):


You have to change the "DocumentRoot" to your desired directory. I have created a "C:\Web\MyWeb" directory on my old laptop. Hence, I change to:

Please not I made the original one commented out by putting  pound (#) in front of the line, and added my own home server directory in its place. I immediately make "C:\Web" directory shared in my Windows "WorkGroup" such that I can work on it from my desktop PC. In this way I never have to go physically to that laptop anymore. This sharing is only on your own Work Group and is nothing to do with public network. Please go further down in the Config file to get to:

Change it as to your newly created root directory of yours,


Now save and close this file and remove the ".txt" extension from its tail back to its original "httpd.conf" Left click on the "Apache http server icon" on your desktop tray and then click on "Restart" on the drop down menu choices. tool tip text shows "All Apache Services Running" Now start to create your web site. Open "C:\Web\MyWeb" directory and on a note pad create any simple html. Then "save as" it as a index.html, or default.html, or home.html. I am running everything from default.htm as I have transported my web site from Microsoft Office Live (OL) and like to minimize my workload during the transition. I have created all three with similar content. That makes it more transportable. But, please note that "httpd.conf" file has a default of its own as the "index.html" that serves on connection. You know that when you type "http://www.anexample.org" in your browser. It brings a default page such as " http://www.anexample.org/homepage.html. " This can be determined in the "httpd.conf" file as we can see,

You can change it to home.html or default.html or comment it out by putting a pound (#) sign in front of  the line 242. If you do not create an "index.html" page as your default home page, the www.anexample.org opens a page with a folder/file tree of your websites including everything you have in the "root directory" you created above. To check that I delete my index.htm page. I have three links here for the test: http://messiah.dyndns.info/ and http://messiah.dyndns.info/Home.html and http://messiah.dyndns.info/Default.html (These as I said could be slow or down due to I turning off the old top.) Later, I explain where "dyndns" comes from.
In the  same directory I create four folders as, "documents" and "images" and "cgi-bin" and finally one I need as "PDFs" One might like to have other folders such as "downloads" or "stylesheets" or"JSes" and so on. In contrast to that, I put my css files naked next to index.html, also if any js file. I have none of this type yet. Next I should open the firewall to allow access of the Internet into that server. I log into my router. (I can log from any computer on my hub.) I click on "Port Forwarding Option/Port Triggering" in my NetGear router it is like this:


Your port forwarding could be blank, so you need to "Add Custom Service." Fill the necessary fields, as described. "Server IP Address" is the fixed IP address given by the hub of your broadband router to the old computer that you are using for your home web server. You can find it by clicking on "LAN Setup" on the left hand pane of the router. I found it as "192.168.1.7" for me. It almost always starts with "192.168.0" for all connected device. Mine starts with "192.168.1" for all device.  After configuring the "Port" please type http://localhost/ in your browser (local host is the loopback to your web server) or if you have a "home.html" type http://localhost/home.html in your browser that takes you to the home page of your "Home Made" website. Next, "How your site becomes visible on the Internet?"
(Update : See also this post Web Hosting at Your Home (Revisited) )