Welcome To My Blog!

I'd like to first say "hello" to everyone. I must lay down a single rule, and it's commonly known by many as the Golden Rule. Please treat everyone in here as you would want to be treated. I ask that no one "flames" anyone else, or say anything obscene or rude. This is a friendly discussions blog that pertains mostly to computers, music, politics, and religion, but not restricted to just these topics.

If you're looking for some computer help, then I highly recommend by starting with my first part in my series:
Computer Advice Part 1 of 9 - Hardware Terms

I also have a website I'd love for anyone to visit at http://webpages.charter.net/drkstlkr/

If you know someone who might enjoy this blog, then please send them an e-mail!

Sunday, August 19, 2012

How To Setup A Free Home Web Server

How To Setup A Free Home Web Server

And why on earth would someone want to do this?  For a few reasons...

  • Personally, it's so that I can teach myself the various aspects of web hosting, such as the software used (Apache/Tomcat, MySQL, etc.), along with HTML, CSS, PHP, JavaScript, SQL, etc.  Running your own home web server is a great way to learn all of the different aspects of a web server!
  • Secondly, you can share whatever you like (docs, pics, music, etc.) instantly anywhere in real time, as long as your home web server is on and connected to the internet!
  • Most "free" web hosting serves have restrictions, such as bandwidth, annoying advertisements, etc.  You avoid these restrictions by hosting your own home web server.
  • And lastly, it's fun!!!  Well, for us geeks and nerds, it's fun, anyways.  :-)


I have to write this simply because you will be opening your computer system more to the internet, meaning that anyone and everyone will have greater access to your computer.  With this being said, I cannot guarantee that someone with malicious intent will not attempt to attack or hack your computer!
With that in mind, I also don't recommend publicizing your home web server to the world.  "What fun is that?", you may ask.  Not only are you inviting hackers, but your internet bandwidth could become drastically slow, reducing it down to a crawl like back in the days when people were using dial-up connections.  Most home users don't have the needed internet bandwidth to handle dozens, hundreds, or even thousands of other users accessing your home web server all at once!  Your home web server should only be used for learning purposes only, and should only shared with close friends and relatives to enjoy.  :-)


Although these aren't requirements, they're definitely recommendations of what you'll want before getting started:
  • Desktop computer
  • Wired broadband internet, such as cable or DSL
  • Router
  • Basic network knowledge, and the time and willingness to learn!

Basic Network Knowledge:

I'm not going into a whole lot of details about this, because people go to school for many years just to learn all this stuff.  However, there are several basic things you should know (listed in alphabetical order):


Ok, now let's get started.  The first thing we'll need to do is to get your computer ready.
If you're running a 3rd party firewall, such as one that comes in many antivirus internet security suites, you may want to disable it and simply turn on (enable) Windows built-in firewall.  For most of us home users, a 3rd party firewall is a bit of an overkill, and may prevent internet access to and from your computer.  Once you disable your 3rd party's firewall (if you have one), here's an article on how to enable Windows built-in firewall at http://www.computerhope.com/issues/ch000551.htm.  If you don't have a 3rd party firewall, you should be able to skip this step and move onto the next.
You will also need to go into your network adapter settings and set the IP address from a dynamic IP address to a static one.  Different versions of Windows have different steps.  The article at http://www.howtogeek.com/howto/19249/how-to-assign-a-static-ip-address-in-xp-vista-or-windows-7/ does a great job at explaining how to do this, with screenshots and everything.  HOWEVER, they demonstrate setting the last number in the IP address to a low number, and setting up all of your network devices to have their own static IP address.  You only need to worry about the computer you're designating as your web server.  Don't worry about the other stuff connecting to your home network, and let the router automatically assign them their own IP address (DHCP, or Dynamic Host Configuration Protocol).  Depending upon how many devices (computers, tablets, gaming consoles, and other gadgets) you have connected to your home network, you may want to set the IP address number just for your home web server much higher.  I have it set to my router's maximum at "254", and don't have to worry about any conflicts with my other network devices.  If I ever make enough money to own 254 internet-enabled devices in my home, then I can afford to pay for a web hosting service!  I also set my DNS settings to use Google's DNS server versus my ISP's DNS server, as demonstrated in the article above.


Now, the computer itself is ready for incoming and outgoing connections.  This is where things start getting a little trickier...  time to setup the router.
In order for your home web server to send and receive information, you have to tell the router where to send this specific information to and from.  At this point, your router doesn't know what computer to do this with, so you must go into the settings for your router.  Most router settings can be accessed using your web browser and going to, but some may be different.  Once you access your router, most require a login and password.  Once again, this will be different for different routers, especially if you've already changed it.  A website that tells how to port forward literally thousands of different routers is at http://portforward.com/.  For now, only worry about forwarding ports "21" (FTP) and "80" (HTTP) to your home web server's IP address that you setup earlier.


Now, it's time to download, install, and setup the software.  There are many free web server packages available on the internet, but from what I've read at the time of this post, XAMPP (http://www.apachefriends.org/en/xampp-windows.html) is one of the best, easiest free packages available.  But don't take my word for it, so here's a Wikipedia comparison chart of WAMPs (Windows, Apache, MySQL, PHP/Perl/Python) available at http://en.wikipedia.org/wiki/Comparison_of_WAMPs.
If you decided to go with XAMPP, I recommend installing everything as a service if you want everything to automatically run when you startup your home web server.  By default, Apache will deny access to all incoming internet connections, so if you want to access your web server outside of your home network, you will need to change a setting in the "\xampp\apache\conf\extra\httpd-xampp.conf" file.  The easiest way to change this setting is to...
  1. Open the XAMPP Control Panel
  2. For Apache, click on "Stop" (on the same row as Apache), if the Apache service has been started.
  3. For Apache, click on "Config" (on the same row as Apache)
  4. Select "Apache (httpd-xampp.conf)"
  5. Notepad should open this text file.  Scroll down to the very bottom of the file.
  6. Change the line that says "Deny from all" to "Allow from all".
  7. Save
  8. For Apache, click on "Start" (on the same row as Apache).
And now, Apache will accept all incoming requests!
The default folder you should put all of your HTML, CSS, and PHP files in is "\xampp\htdocs".  Although you can organize your files and folders (directories) any way you wish, I recommend creating these folders:

  • "css" for CSS (Cascading Style Sheets)
  • "htm" for other HTML files other than your index file (home)
  • "img" for image files (logos, pictures, photos, etc.)
  • "media" for music and video files (use sparingly!)
  • "php" for other PHP files other than your index file (home)
  • "script" for JavaScript files

If you attempt to run the Tomcat service on an x64 (64-bit) Windows operating system, you may run into service issues.  I'll post how to fix this later.


After everything is setup and running, you're now able to access your home web server on the internet!  But wait, how do I access it?  Well, unless you want to pay your ISP (Internet Service Provider) about $5 per month for a static IP address, a free way around this is to use a DDNS (Dynamic Domain Name System) service.  In a nutshell, you're assigned a DNS name of your choosing (with limits, of course), and this DNS name gets updated frequently whenever your IP address is changed by your ISP.  This can be done a couple of different ways:
  • If your router supports it, your router can update your current IP address to the DDNS service.
  • Download and install software from the DDNS service that automatically updates your IP address.
Since my Netgear router only supports DynDNS (http://dyn.com/), that's the service I chose to go with.  However, they require a credit card for a 14-day free trial.  Once I got everything I wanted setup on their end, I cancelled the trial, and I still get to keep my one DNS name for free.  After I had already set everything up, I had heard of issues of routers not properly updating the DDNS service correctly and frequently, so I downloaded and installed their updater client software (http://dyn.com/support/clients/windows/installguide/) anyways, so that my dynamic IP address from my ISP is updated by both my router and my computer.  I didn't want to take any chances.  ;-)
If you don't want to use a credit card, there are many other truly free DDNS services out there.  A popular DDNS service at the time of this post is No-IP at http://www.no-ip.com/.  No matter which DDNS service you choose, always be sure to download and install their updater client software so that your computer can always tell their DNS service what your ever-changing IP address currently is.


For anyone who's wanting to learn HTML, CSS, PHP, JavaScript, SQL, and much more, to help get you started, I highly recommend:

This article is mostly finished, but not completed!

No comments: