Welcome to WebmasterWorld Guest from

Forum Moderators: brotherhood of lan & mack

Message Too Old, No Replies

Hosting from home

Guide to hosting your own server from home

8:32 pm on Apr 24, 2005 (gmt 0)

Moderator This Forum from GB 

WebmasterWorld Administrator mack is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:June 15, 2001
votes: 3

Over the past year or so there has been a growing trend of post from users who want to host their sites on their own systems.
I think it would be good to hear from people who have actually done or are doing this. I don't think we should just say yes or no, but offer as much practical advice as possible and voice our options on this matter.

It has to be said that in 95% of cases hosting with a web hosting company is by far the best option available. When you use a hosting co you aren't just buying disk space and bandwidth you're buying their experience and their expertise. Web hosting companies handle the complexed issues involved with server administration on a day to day basis and are generally very able to provide a high level of service and availability.

I took the plunge about a year ago and began hosting my site from home. for me the entire outcome was based on a financial decision. The project I was working on would involve using at least 2 fairly high speck dedicated servers. The cost of leasing the boxes was just to high for what is no more that a hobby project.

The ruit I decided to go down was to build the servers myself and then host them from a spare room at home. I am far from being a networking or hosting expert but I did a lot of reading (mainly here) and was able to be up and running in a matter of days. It is fairly easy to have a server available but that is pretty much the tip of the iceberg.

Technically all you need to do is build or acquire a computer that you intend to use as a server. Install the operating system of your choice and a server application such as Apache or IIS. In my case I went with a combination of Linux/Apache although it has to be said the principals for home hosting are very similar between Windows and Linux. The principles are the same, only the procedures vary.

Lets imagine we want to set up a server to serve a website that is publicly available via www.example.com Because all my self hosting experience has been on Linux servers I will stick with what I know. I am hopeful someone will be able to offer us some info about hosting on Windows based web servers.

The first thing you will need is an internet connection that is able to handle your traffic load. When hosting from home this will be your biggest obstacle. The cost of a very fast internet line will very often be a barrier. As a result of this connection speed will very often be your bottleneck.

To make an attempt at true hosting you will also require a fixed ip address. A fixed ip address is an ip address that never changes. some services provide this at an extra charge. Be sure to ask your provider if this is available. It has been knows for some providers to allocate the same ip address to users for a period of time then suddenly flush their ip configuration and allocate different ip addresses to their users.

A static ip address is one of the most important factors to take into account before you even think about hosting from your own location. Another important piece of information you need to find out from your provider is do they block ports. A port is almost like a data stream. For example the default port for web traffic (http) is port 80. If you later found out that your connection provider was to block port 80 you would not be able to serve any web pages on the default port. It is still possible to serve page an another port but it is always the preferred option to provide services on the port they where designed for.

There are various other ports that you may need. email, ftp, ssh, https to name but some. We will not go into these other service ports in any great detail here. But ideally you should look into using a connection provider that does not block any ports. You should also email any potential providers just to make sure "Am I allowed to use your service to host a web server?" if they say no then you have just saved yourself having your service terminated for abuse. It is very important to adhere to your providers terms and conditions at all times.

The second item on your wish list should be a router. I would be tempted to get a router that has a built in firewall. Today many routers act as modem/router/firewall combinations. The main benefit to this is you do not require a separate unit for each component.

You can also configure it from on admin interface. It is very important to get your router/firewall configured correctly. not only does this act as your internet access point it also acts as your first point of security.

The firewall will help to protect your network from intrusion from the outside world. Lets imagine you have a server and your pc on the same LAN. You will want users to be able to access your server via http but you will not want them to be able to access your pc under any circumstances.

There are many different routers on the market and it would be simply impossible to go into any great detail for all of them so we will try and keep it as simple and general as possible. The first step is to set up the router for internet access.

To do this you should be provided with all the required information from your provider. Once you have done this you should test your web connection to make sure it is working.
The next thing you should do it to configure your server. In my case the server was a Linux server that connected to the router using standard network cable via it's NIC (network interface card) Many Linux distros such as Suse and Redhat have graphical user interface tools to help you set this up correctly.

The important pieces of information you need to provide is the computers IP address. This is not the IP address of your internet connection it is an internal LAN ip address for example You should set your server so use a static ip address and provide an address within the same subnet as your router. This is very important because if the server and router are on different subnets then they will not be able to see each other on the network. It also makes sense to have your LAN IP addresses sequenced in order.

The router ip address is the address you visit to view your router admin area. This is usually if you are not sure about this ip address please consult your router manual or user guide. We now have the router on and the server on You will also need to provide "name server" information to your web server. A name server is used to help the server convert domain names into numeric ip addresses. you should have 2 name server addresses. typically NS1 and NS2. usually there will also be a routing option within the user interface. Within the routing section all you need to do is provide a gateway IP address. The gateway ip address will be the LAN IP address of your router. (i.e.

You can set up your network card using either Yast (Suse) or Redhat installer. Most modern Linux distributions have similar tools. Unfortunately I can only comment on what I know and have used.

If you have a windows PC on your network I suggest you also set it up to use a static ip address. By doing this you will be able to turn of DHCP on your router and keep things nice and simple.

DHCP is a system whereby the router allocates a dynamic address to all client computer on the network. In order to configure windows to use a static ip address you should do the following.

Click on start > control panel and your windows control panel will open. Click on "network connections" this will open up a screen displaying your network connections and their current status.

choose the connection that refers to your current connection between your computer and your router. and left click it.

Choose "properties" from the drop down list. This will open the properties dialog box for your local area connection.

Click on internet protocol (TCP/IP) and click on the properties button. this will open the internet protocol (TCP/IP) dialog box.

Within the dialog box you have the option to assign an IP address or use DHCP. DHCP simply means that your router is automatically issuing dynamic IP addresses to all client computers on your local area network. Select "use the following ip address" and insert an ip address in the box provided. for example You will also need to insert 2 values for your name servers NS1 and NS2. These are the same values we used for setting up the network card on the server.

You can then click OK and your settings should be saved.

You should now re-visit your router admin page. You now need to make sure DHCP is turned off. This not really required but is seams wrong to have an unused service running. usually you then need to specify a hostname and ip address for each client on the network. Not all routers require this although both that I have used did require this.

This is basically telling the system that this IP address is reserved for this machine. At this point make sure all ports are closed. By ensuring all ports are closed no part of your network will be open to the outside world.

Now that you have your network pretty much set up you can how begin configuring your server to host your website. For purposes of this example we will assume your name is "Joe" and you have a user account on your Linux computer called "Joe" If your PC and server are able to see each other across the network you should be able to use ftp across your LAN. In order to do this you need to have an FTP server installed on your server. Some popular examples on Linux are vsftp or proftp.

Bother are very good ftp servers and are very comparable. Most Linux distributions will come bundled with some sort of FTP server. By default it may not run as a service at boot time so you may need to set this up in your inet.d configuration.

If you have an ftp server set up and running you should be able to log into ftp://your.server.ip using your Linux system username and password. Your website files will be stored in the /public_html folder. In reality what you are actually doing is ftping into /home/Joe/public_html

If you already have a site built you can simple move the files into your users web space. If you set this up correctly you should be able to browse your site using the following address. [server.ip.address...]

It is important to remember that if web traffic was to arrive now to your server it would be pointing to the IP address of the server and not the correct location of the web files. In order to allow people to be able to view the files via a domain name we need to use what is called name based virtual hosting.

Name based virtual hosting as a fairly simple method of telling the server where to send users who arrive at the server. It used the domain name they arrived via to determine where they should be sent.

Virtual hosting can be set up using your httpd.conf file (apache configuration file) To set up a virtual host to enable the domain www.example.com to resolve to Joe's public_html directory you would use the following syntax


<VirtualHost *>
ServerName www.example.com
DocumentRoot /home/Joe/public_html/

The first line is the opening tag for the virtual host. the "*" is to let the server know that this virtual host is accepting traffic on any port. You couch replace this with a numerical value if you wanted to block non standard ports requests. On this case I am blocking non standard ports from the router so have left this as default for any port.

"ServerName www.example.com" this is to tell the server what domain it is to accept incoming traffic for. Any other domain that is not placed within a virtual host will be ignored.

"DocumentRoot /home/Joe/public_html/" this line tells the server where the files for the users doc root are located.

The virtual host is then closed almost in the same way as you would with an html tag. </VirtualHost>

In order for your virtual host to work you need to save the changes to your httpd.conf file and restart apache. If you have a control panel installed on your server you should be able to do this from within there. Alternatively, try shelling in as root and running "apachectl restart"

You should get the following output in your shell "httpd restarted" If apache was successfully restarted then you should be able to try the following test.

Go onto a pc on your network and alter the host file as follows.

server.ip.address www.example.com

If you visit www.example.com on your pc you should now be able to view your website.

This is because you are placing a request for the domain and the request is being relayed to the server. The server will receive the request and find there to be a suitable virtual host entry. It then displays the content based on the location specified within the virtual host entry. The reason I suggest adding it to your host file is because you do not want your request to go into the world outside of your network. You are just making the http request over your LAN based on a domain name.

You can have several virtual host entries. Virtual hosting is now pretty much the standard used by the hosting companies to offer shared hosting. You can have literally hundreds specified within your httpd.conf file but lets take things slowly for a start.

Here is how 2 virtual host entries would be set up.

<VirtualHost *>
ServerName www.example.com
DocumentRoot /home/Joe/public_html/

<VirtualHost *>
ServerName www.example.net
DocumentRoot /home/Sue/public_html/

Continued on next message.....

8:58 pm on May 17, 2005 (gmt 0)

New User

10+ Year Member

joined:May 17, 2005
votes: 0

Well I guess that means I have alot of work to do beofre I put my server on the internet. Hahaha but I will be taking all of your advice, I already have my router set up and the rest of my in home net but I need to get FTP (free preferred) and then Iíll be on my way, oh and who here runs a windows server? I have a windows 2003 enterprise edition server that I just love and was wondering who else runs windows based servers!

[edited by: Woz at 5:01 am (utc) on May 18, 2005]
[edit reason] Formatting [/edit]

This 31 message thread spans 2 pages: 31