Showing posts with label W3C compliancy. Show all posts
Showing posts with label W3C compliancy. Show all posts

Saturday, 22 December 2012

Web Hosting at Your Home (Revisited)

(For the latest PDF files Merger Software please have a look at the top of the left margin, inside the red box.) From the time that I wrote the post on this topics, many things has changed. Now, I revise the material.

First, you need a dedicated computer to install and run your webserver on that. I used to use an old laptop; it was older than ten years. Regretfully it made a lot of noise during the night cooling the CPU. CPU was 2 GHz, but with small CPU cache it was killing slow. It still had some customers to earn some cash, so went on auction site and "bid" farewell. As I have a very cheap and high quality paid hosting, I didn't bother to replace the home web hosting laptop. I put the home hosting on my computer, hence when I hibernate the computer or shut it down it is not visible anymore.
  • Therefore, if you want to use an old laptop as a server consider how far it is still useful. You frequently have to work with it and if it is too slow, it can make you impatient. It is difficult to upgrade its CPU and impossible to improve its cooling mechanism. It also consume some electricity and it creates some noise.
  • If you decide to use an old desktop (tower) computer, you easily can upgrade it to a more powerful one. You also can get almost good computers with very low prices on auction sites. They consume more electricity and for tuning you need to connect keyboard, mouse and screen to them. Their noise also might be too much.
  • Considering expenses all together a web hosting at home might not be profitable comparing to a purchased web hosting mostly under $40, $50 a year. But it is rewarding in terms of having a hobby. If you have a small business and hoping to develop it or it is growing it is a good practice to keep your IT operation under your control and within the horizon of your understanding; then web hosting at home could be a good exercise to that ends.
  • Call the computer of your home web-hosting your "web server" after this.
Second, download and install Apache HTTP (web) server to your home web server. To do that
  • Create a folder in the root directory of your web server as C:/Apache Software Foundation/Apachex.x where x.x stands for the version of downloaded software. Mine is Apache2.2. 
  • Install Apache server and during the installation instruct Apache to be installed in that C:/Apache Software Foundation/Apachex.x folder.
  • Fill in the installation form of Apache. You can fill its field with anything that looks like a website name and email. Later you can correct them in conf/httpd.conf file.
  • Open htdocs folder inside Apache2.2 and double click on index.html if it opens and shows "It Works!" then you have been successful so far.
  • If succeeded change name of index.html to indexold.html.
Now it is time to bring your website into your home web hosting.
  • From wherever you have saved your website copy all the files and folders and paste them inside the htdocs folder of your Apache.
  • You have a front or home page. It could be home.html, index.html, or default.html. Extensions could be html or aspx or other accepted extensions. Make a copy of that and change its name to index.html. Having done this you do not need to tweak with conf/httpd.conf file for now; until later that you become an advanced user.
Log into your router, normally by typing 192.168.0.1 (or in some routers 192.168.1.1) in your browser.
  • Find the IP address of the web hosting server computer of yours from the "Connected Devices" section. It should be something like 192.168.0.7
 While still  logged in the router note that in all routers there is an "Advanced Settings" and inside that a section for "Security" settings. Among the "Security" settings you'll find a "Port Forwarding" area. Enter in "Port Forwarding."
  • Select HTTP for name of the "Service."
  • Select TCP for "Protocol."
  • Enter IP of your web server computer into the IP field (192.168.0.7).
If you are in Windows XP this is fine enough. If you are in Vista/ Windows 7 or Windows 8, you need to instruct the Windows to make an exception in the Firewall to allow inbound traffics for your web server.
  • Open "Control Panel" and then open "System and Security."
  • Click on Windows Firewall to open its dialogue.
  • On the left side list find "Advanced Setting" and click on it.
  • A "Windows Firewall with Advanced Security" dialogue will open.
  • On the left side list click on "inbound rules."
  • Now on the right side list click at the top on the "new rule."
  • Among the selection radio buttons click on "Port" and the next.
  • In the next dialogue click on "TCP" radio button and then specify on the "Specific Local Ports" by typing value 80 in the field and then next.
  • In the next dialogue leave "Allow Connection" as it is selected by default. Click next.
  • Well your web serving computer is in your home. Hence in the next dialogue you need to select "Private" network by ticking the box. Click on next.
  • In the next dialogue select a "Name" for your rule such as "My Apache Web Hosting." Click "Finish" and you are done.
After setting up the new "Firewall Rule" type http://localhost/ in your browser. That should bring your home page. Look at your browser it is just http://localhost/  with no index.html or anything after that. This is a good lesson for later tunings. Now click on your "Home" link (you have that link somewhere in your front page), then browser changes to http://localhost/home.html or http://localhost/default.aspx or whatever file you have as your home page. I decided to have mine as default.html since I found it more comfortable to work. I have three similar copies of my home page as index.html, default.html and home.html inside the htdocs folder of my Apache.

You have your web server hosting at home up and running.
  • Get your main internet service IP from your router or by typing "my ip" in your favourite search engine. It should be something like 87.321.46.18 (this is not a real IP as one of the numbers is greater than 255 which is impossible).
  • Ask a friend to type that IP in their browser. Check if your web hosting is visible for them.
Hopefully you have done all you need at home for your web hosting. It is disappointing that it is visible only for your acquaintances. Next make it visible for the world.
  • One solution is to get a free subdomain from numerous provider. They do it in a hope that one day you are going to get one of their paid services. Once they get enough clients, gradually they kick out free nerds with excuses. One I am using is DNSdynamic. They provide you with a free client to be installed on your computer. You do not need this client in principle. I'll explain for you in a minute. Sign up to their site and select a name for your site, say homelyhost, then your address will be, say, homelyhost.dnsd.info. There are other options besides dnsd.info. Mine is messiah.dnsd.info. These types of names does not look much exciting.
  • While logged in the DNSdynamic website, or wherever, use their provided instructions and point the name (say, homelyhost.dnsd.info) to your IP (87.321.46.18).
  • Log out and test the name in your browser. Sometimes it take 24 hours that things become sorted out throughout the worldwide network of Internet.
Reason for installing the client is that normally people have dynamic IP which is subject to unnoticed arbitrary change by their Internet Service Provider (ISP). You do not need the client as much since due to technical issues IP addresses will be kept static and without change for a long time and years if you do not move from your present address or you do not change the Service Provider.
  • You can check your IP every now and then, perhaps on a daily basis, and if it had been changed log into your member page at DNSdynamic site and point the name to new IP.
  • Alternatively you can buy a static IP.
(Update 26/April/2014: As explained here and I expected DynDns that I already had, has informed me that they can't continue providing free services anymore. Their offered prices are so unreasonable as if they are living in another planet. I moved to DNSdynamic.org, and edited this blog post, accordingly. They look very innocent now.)
You might like to buy a name for your web site that you are hosting at home. You have not much options now a days for selecting cool and conspicuous names. They are already gone or big companies have bought them, in speculation, to sell them to wealthy people, celebrities and companies who need such names. Even misspelled names are sold already for famous brands. If you type in browser say foerd.com you might get to ford.com, for instance.  They also may use it for "parking" sites. If you browse by misspelling ford as foerd you reach to a site that has parked advertisements for car selling/repair/used-car companies and during the year might bring few hundred dollars for its owner.
If you need very ordinary name, especially long names, these names are sold on a yearly subscription basis and are not expensive. They are from $5 to maximum $25 per year. I bought a dysprosiumsoft.com for $8 a year.
I pointed it to my webhosting at my home, but how. Sites such as DynDns asks paid subscription to provide such a pointing service which is called DNS or Domain Name Services.
  • You need to use a free DNS provider.
  • There are many of them out there with the same rule: when they get enough people convinced to upgrade to paid service they kick out the remaining die-hard non-paying nerds.
  • I found freedns.afraid.org more nerd oriented than others and very easy to configure (© 2001-2014 Joshua Anderson, Free DNS is currently processing 4,373 DNS queries per second).
  • I signed up to their free subscription and followed their instructions to point their DNS to dysprosiumsoft.com and then dysprosiumsoft.com points to my IP. Click on http://dysprosiumsoft.com and if my computer is on (mostly GMT : 8 am to midnight) you will see my web hosted on my own computer. It is also the same pointed by http://messiah1.ddns.net/. They both land on the same folder. I have one folder for home web hosting but I have pointed two names to it; similar to foerd.com and ford.com that points to the same site such that if people make a mistake while typing in browsers they land on the same place. I have added a small tag at the top (Home Web Hosting Demo) to be recognised from the out-sourced professionally hosted http://messiahpsychoanalyst.org.
  • Click on the W3C validation at bottom. It becomes validated similarly.
Believe it; it needs some patience.

(Disclaim : names I used in this note are those I am using I have no idea regarding recommending or endorsing them. Though I am thankful to them but you might prefer using your favourite search engine finding similar services)

Please also see a newer post Web Hosting at Your Home : PHP and Port Forwarding Conflicts

Wednesday, 16 March 2011

W3C Validator Compliancy for Microsoft Office Live Web-Hosting and Facebook Buttons (2)

(For the latest PDF files Merger Software please have a look at the top of the left margin, inside the red box.) I needed to add few words to my previous comment when I was experiencing for compliance of my website. First, I said that I use Microsoft Office Live (OL) templates. That is a good practice. Design of OL templates are done by the very competitive professionals in the industry. Thus should not be retired easily. An example is implementing the idea of  "zones." That makes doing things easier. Or the site maps so neatly designed. Or the OL visitor reporting Java Scripts. I keep as much of them as possible. I use all the facilities provided by OL such as their css and js files. I learn lot from them. Still, if I would not create my web, based on pages loaded from Document Gallery and I had limited myself in using pages created solely by the Microsoft Office Live, then I could not use a panoply of editors and other tools that I have on my ease in my local computer, without being have to sign in and open the OL console. I create my page, on my own desktop, by adding an "_AA" to the beginning of the file name. That takes it to the top of the list of OL Document Gallery and when I delete it to put a new one I do not delete a working page inadvertently. I test the page and debug it completely. I add the validator codes to it to be able to test it frequently. W3C validator also helps in finding and removing errors of the page. I delete and upload again and again and when I become sure about all aspects of the page then I add its file name to the directory of my web site. I change its name to whatever it should be, and then I upload it. On the other hand I have implemented an Apache web server on an old laptop at my own home. That mirrors my OL website and is connected to the Internet by a DynDs free domain name (perhaps later I can convey my observations about how to set up such a facility at home). My OL site pages, both root and Document Gallery pages have dependencies to different css and js and asp files from Microsoft hosting servers. On my toy home server I try to reduce all those dependencies to nill. I do it in a very neat manner with a system analyst approach. For example I do not create new dependencies to new providers, say free cgi hosting or other freely offered servers or thirty days trials. It has one root page, and a document gallery (Documents folder), and an image gallery (Images folder). I can add my own css, js, cgi, name space, and experience with ajax. I try to make it robust and be validated with strict standards. It is said that web designers should not have qualm with W3C validator or other strict QC criteria, and it is a geek obsession to meet such strictness. As an example you frequently hear that an average Amazon page has 17000 error and warnings through a W3C validator gauging. This is not a relief. Computer is the product of very well organised people specially pioneer system analysts. If during the design we follow few easy steps then the entire Internet becomes more smooth and cheaper to experience for those who are only users and actually pay back the expenses of the producers and have not time for technical difficulties that might be the result of relegating the standards. After all, I backup my entire site on a DVD.  In this way my web site will be completely migrate-able in a snap of finger. It is like a duffel bag ready to be deployed anywhere. My next goal is to validate this blog spot.

Wednesday, 16 February 2011

W3C Validator Compliancy for Microsoft Office Live Web-Hosting and Facebook Buttons (1)

(For the latest PDF files Merger Software please have a look at the top of the left margin, inside the red box.) I already had some of my experiences with Microsoft Office Live (OL) web hosting, which came useful for some of the visitors of this Blog. Recently my daughter had a look at my website with her FireFox browser and noticed that some pages of my site was not much readable from non-IE browsers. That gave me the idea that I should make my site standard based on the WWW authority criteria. I already had used the generic ASP template of OL, but with the loading of my designed pages from Documents Gallery of OL rather than the root directory. That makes the custom design more practicable. I can keep a couple of pages or even only one page in the root and the remaining pages of my site in the OL Document Gallery. (Even if you had an Apache server as your own personal host you would do that. This makes migration and other tweaking easier, too) Yet, using a note-pad for design meant no way of controlling it for the errors and we know that browsers are robust entities that interpret and run any design without much taking heed to errors or informing us about them. To control the errors I needed an intelligent IDE for design of pages. There are few free IDE's available, including Microsoft Visual Express Studio (now version 2010). I preferred to use NetBeans (NB) IDE latest version. Both IDE's have intelligent interfaces with capability to suggesting a list of possible codes and showing errors. NB shows mis-spelled words too. Hence, I opened one of pages with that IDE. Lo, and behold! All the lines were underlined with red as the error laden codes. Tables were not nested properly, tags were not furbished with correct way of tag-ending. Tags were used in wrong positions. Some tags and attributes were deprecated. A mixture of capital and lower cases were used for some tags. But the most important I found was the "Standard" that you declare at the top of the document from the W3C source. Some people have got the wrong idea that if you declare, say, two standards as HTML 4.01 and XHTML 1.0, it is helpful for interpretation by browsers. They say if you forget "/" at some tags like <img> then the page complies. This is not a correct way of practice. Hence, I decided to select one that looks easier to follow. I typed <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >. I knew that there is no compromise on capitalisation. For example, if I write "/tr/" in place of "/TR/" an error occurs. That forces me to change <html> beginning tag to <html xmlns="http://www.w3.org/1999/xhtml">. Having typed that, all the error points changed and their number reduced but new errors came out. <br> without ending "/" is not allowed. I used the "Edit -> Replace" command of IDE to do that job for me. Another simple change is that no tag or attribute or its value is allowed to remain capital. You cannot type <TABLE> or FONT-SIZE. They should be <table> and font-size, respectively.  The funny thing happened when I used "Replace" command to change table row tags from capital "TR" to lower case "tr" Suddenly number of errors rocketed up. Yes, the before mentioned file path, "/TR/" in the topmost declaration for using transitional XHTML also had been changed to lower case. Using the "Replace" command should be acompanied with caution to prevent damaging capitalisation of the content of the page already written. If I want to change all the paragraph tags and their end tags from capital to lower case with one command and with no qualm about the content I should say (to include end tags, as well) replace "P>" with "p> " Then no capital P at the beginning of a sentence will be changed. (Peter will not come as peter!) I changed all the deprecated attributes to correct ones, as well, without being worried about any mistake. I changed obsolete "name" attributes to "id" attributes. I followed the rules of W3C in using the correct literal adjectives instead of using those which looks correct to a coder's mind. For instance nowrap="true" should be replaced by nowrap="nowrap". Align attribute for image tag is "middle" but in other places it should be "center". I could not use <li> </li>without nesting them in <ul></ul>. I used the automatic intelligent tabs of the IDE to gradually correct my tables nesting structures by checking the returning columns of line-feeds until each table and each row and each column of it become closed at the right position symmetric to opening tags. Once you put the "id" of a data column in a row of a table it is not necessary to repeat it in other columns (one of the common errors of my OL template). I continued until my file opened in the NB IDE didn't show any error or any warning. I deleted the old file from the Microsoft Office Live Document Gallery and uploaded the new file then I went to W3C site and checked my newly uploaded page. Congratulation page appeared for my web page. Now, gradually I am refurbing other pages. There are some tag extensions out there not in coordination with W3C bodies. One of them is the <fb:like> for facebook's "Like" button. or tags for embedding objects. If your page fails only for using tags like that but in terms of everything else is correct, use the W3C emblem. The visitor can check and appreciate that you have been meticulous in your design, but only failed for a widely used tag not yet been standardised. At the same time time put pressure on developers of Facebook, Creative Commons and some other important web entities to standardize their codes with neater extensions by offering them through RFC or other means to decision making committees of www. (I haven't checked, yet, if I can nest them as CDATA inside a script tag as work-around to pass the validator check, but I'll do and inform you later.)
Update 17/Feb/11: I worked it out now.
Change your <html xmlns="http://www.w3.org/1999/xhtml"> tag to <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb=http://developers.facebook.com/schema/> to accommodate for Facebook extension. Then at the place that you wanted to plug the Facebook button in add the following Java Script:

Change attributes according to your requirements and taste. Please note that CDATA is commented out. My "Downloads Page" with "Facebook" button, now have passed the W3C Validator check successfully.