Let me first give you a quick answer before I bore you with details.
Yes, you CAN host a web site on your home/office computer.
And why do I think it is an interesting question - Because, unfailingly, at least one student from my beginners class throws this at me and so I guess it's something that everyone wants to know. Also the answer to this question helps us to know, in a little bit more detail, what web servers are and how they work.
Let me rephrase the question - Why can't our home computers with broadband internet and 24/7 connectivity be used as web Servers and host web sites? Actually, our home computers CAN act like web servers. Here are a few things we need:
- A static I.P. (Internet protocol) address
- 24/7 Internet connectivity (a fast connection would definitely help)
- Web server software
- A stable and reliable operating system
Hosting your web site from your home/office computer
Typically, a web server is a powerful machine with a stable and reliable operating system and a 24/7 Internet connection. A web server also needs a static I.P. (Internet protocol) address so that the location of the hosted web site/s does not change. In addition to the web server software (which serves web pages), several other software that help in maintenance, enhancing functionality and securing the machine from attacks from hackers need to be installed on the machine.
The need for a good operating system
Obviously, you need a stable and reliable operating system that can serve web pages quickly and not crash or hang even under heavy traffic. Here are some other hallmarks of a good operating system for a web server:
- In-built security features to protect from hackers and virus attacks.
- Easy of administration through shell environment or GUI-based software.
- Scalability to up-gradations to ensure enhanced stability and security. Also, the process of installation of updates should easy and as smooth as possible.
- In-built necessary server software should be a part of the operating system else, they should be available and installed quickly and smoothly.
- Availability of third-party software - No operating system is perfect and complete. Third party applications can provide additional security, better features and functionality.
With the above points in mind, the Linux operating system fits the bill pretty well - So does Windows, actually, but you do need to be a little more experienced in server administration if you want to run a Windows based web server.
Linux is also cheaper than Windows and has tons of free third-party software and applications that can be smoothly integrated in the operating system to increase functionality and security. Linux, which is an Open Source Software (OSS), works well with other OSS such as Apache (the most popular web server software), MySQL (a good stable database application and server), PHP (server-side scripting language) and has several in-built applications such as FTP (File Transfer Protocol), sendmail (SMTP email server) etc.
The need for a static I.P. (Internet Protocol) address
Each computer connected to the Internet needs to have a unique number assigned to it so that it can be identified and there are no conflicts with other computers. This unique number is the Internet Protocol (I.P.) address. The I.P. address is just a series of four numbers each less than 255 and separated by dots (periods). For example, 214.34.7.90 would be a valid I.P. address.
Since, for us humans, I.P. addresses are not as easy to remember, the "powers that be" created domain names. However, each domain name is "tied up" or "associated" with an I.P. address. The domain name and its corresponding I.P. address are stored on several different computers scattered around the globe. These machines called Domain Name Servers help to resolve the domain name to its I.P. address. In layman's language - when you type a domain name on your browser, it first checks with a Name Server and gets the corresponding I.P. address (something that computers understand better than us) and then loads the web site.
An I.P. address is the address of a computer on the internet - it specifies the location of a server that hosts a web site. It follows that if the I.P. address changes, the web site will not be found if you try to load it on a browser by typing its domain name.
Now, most of us use net connections on our home/office computers from the local Internet Service Provider. These ISPs assigned our computers with a dynamic I.P. address each time we connect. Thus, each time we disconnect and start the connection again, our computers are given a different I.P. address. So if the I.P. address of your home/office computer changes, your web site will not load unless you go and change the information on the Name Server. Obviously you cannot make these changes each time your computer's I.P. address changes. For this reason, to host a web site on your home/office computer you need a "static" I.P. address - an I.P. address that does not change.
The problem is that ISPs generally do not allow you to host a web site on your computer. And they do this by allocating a new I.P. address each time you connect and also blocking required ports. Having said that, you can get a static I.P. addresses by either upgrading your package (to something like a "business package") or shift to an ISP that does provides one. The cost of a static I.P. can be an extra $30 to $50 per month (maybe even more). Check with your Internet Service Provider. This, in my opinion, is just too much when web hosting companies offer feature-rich packages for as low as $10 per month.
Also check DynDNS.com if you want a static I.P. from a dynamic address. FYI, some ISPs would actually fine you if you host a web site on their net connection.
The need for 24/7 connectivity to the Internet
A fast Internet connection is as important as a stable 24/7 connection. You would not like your web site to download slowly would you? Any downtime in the net connection would result in your web site being offline.
The need for Server software
According to Netcraft server statistics, Apache still is the most popular and widely used web server on the net. Apache is an open source software (read free) that can be installed on various platforms including Linux/Unix, Windows, Mac. For more details on Apache refer - What is Apache and what does it do?.
You can also have a look at a detailed list of important web servers.
Its easy to install the Apache web server. In fact, most Linux versions come with an Apache server already running or one that can be installed and configured in a few clicks.
The need configuring your computer
If you plan to host a web site on your home/office you cannot leave it open to attacks by hackers. Also you need to protect important directories - ones containing files of the operating system or other programs that are critical for smooth and error-free running of the server. Your system has to be configured properly to protect against accidental or intentional misuse.
The final conclusions
Hosting your web site on your home/office computer would be a great learning experience to all adventurous people out there. For most of us, it's wiser and quicker to just go to a reliable hosting company and pick up a web hosting package because these companies take care of maintaining the server, the internet connection, server security and power backups.