Click here to login to Rapidleech.

Web Server Tutorial

Everything about Web Server and Hosting Provider.

What Is A Web Sever?

A web server is a piece of software that enables a website to be viewed using HTTP. HTTP (HyperText Transfer Protocol) is the key protocol for the transfer of data on the web. You know when you're using HTTP because the website URL begins with http:// (for example, http://downloadfullfree.com

You might be thinking "I always thought a web server was a special, high-powered computer". Well, you'd be right too. Some high-powered computers are referred to as web servers as they have been built with web hosting in mind. But in most cases, when someone refers to a web server, they are referring to a piece of software that you install on a computer.

What does a Web Server look like?

That depends on which web server you choose to install. In general there is one website (called Default Web Site), one FTP site (called Default FTP Site), and one SMTP virtual server (called Default SMTP Virtual Server).

You can right click on an item to display it's properties. For example, you can right click on Default Web Site to display (and configure) the properties of that website.

Web Servers are Easy!

You might also be thinking that web servers are way too advanced for you - that they are only used by professional web developers and/or hosting companies. Please don't think that!

And, depending on your computer set up, you may even find that you already have a web server on your machine.

Now, having declared that "web servers are easy!", there are many advanced topics regarding web servers. I won't be going into any detail in this tutorial. You can get a web server up and running on your machine with a minimum of technical knowledge. Then once you've done that, you'll start to become familiar with the various options available to you. Then if required, you can research the more advanced topics to suit your needs (such as security, load issues, logging etc)

Web Server - Advantages

While you can certainly create and test HTML pages on your local computer without a web server, most web professionals use their own web server.

There are many advantages to using a web server within your development environment. Of course, in a production hosting environment, a web server is essential. And, depending on your website, a web server could indeed be essential in your development environment.

When I say "development environment", I'm referring to a copy of your website, usually on your local machine, that you use to perform updates before you commit them to the live (production) environment.

In practice, you could have many copies of your website for different purposes (such as testing, training, protypes etc), but let's just call it "development environment" for now.

Viewing HTML Files Without a Web Server

When someone learns how to code HTML, chances are, one of the first things they learn to do is how to view their (newly created) HTML file. They will learn that you can simply double click on the HTML file, and this will launch it in their web browser. And from that point on, they can view their web page/website as it was intended to be viewed.

Here are some examples of what the URL could look like when viewing a web page without a web server: file:///C:/Inetpub/wwwroot/index.html

These examples are using the file protocol in order to display the files.

Viewing HTML Files With a Web Server

One problem with the above method is that, you're not viewing the website using the HTTP protocol (you're using the file protocol instead).

Now, this isn't normally a problem if you're only using client side languages such as HTML, CSS, and client-side JavaScript. But it is a problem if you're trying to use a server-side language such as PHP, ColdFusion etc

Also, even if you're not using a server-side language, it could still cause you problems with developing a website that behaves exactly how it should on the web.

When you view a web page via a web server, the URL begins with http://. Also, the URL will consist of either an IP address or a domain name/host name.

When you first set up a web server, you can usually navigate to your default web site typing http://localhost or http://127.0.0.1. When you add more websites, you'll need to create your own URLs for them (via a DNS server or Hosts file), then assign that URL to your websites via your web server.

Web Servers - Features

There's a common set of features that you'll find on most web servers. Because web servers are built specifically to host websites, their features are typically focused around setting up and maintaining a website's hosting environment.

Most web servers have features that allow you to do the following:

Create one or more websites. (No I don't mean build a set of web pages. What I mean is, set up the website in the web server, so that the website can be viewed via HTTP)

Configure log file settings, including where the log files are saved, what data to include on the log files etc. (Log files can be used to analyse traffic etc)

Web Servers - Features (Cont.)

Configure website/directory security. For example, which user accounts are/aren't allowed to view the website, which IP addresses are/aren't allowed to view the website etc.

Create an FTP site. An FTP site allows users to transfer files to and from the site.

Create virtual directories, and map them to physical directories

Configure/nominate custom error pages. This allows you to build and display user friendly error messages on your website. For example, you can specify which page is displayed when a user tries to access a page that doesn't exist (i.e. a 404 error).

Example Web Server

Here's an example of the Properties dialog box from Microsoft IIS. This box is displaying the properties for a single website. To display the box, I simply right-clicked on the website and selected Properties.

You can see that the website has been configured to use the local path of c:\inetpub\wwwroot. What this means is that when you update your website, you need to place your files and folders within that directory. As soon as you do that, your changes will take effect on your website. Of course, if this is your development environment, you can simply edit the files straight from that directory.

Examples of webservers are available at here.

How Web Servers Work

Web servers are responsible for serving up websites. Here's a brief overview of how it all works.

Whenever you view a web page on the internet, you are requesting that page from a web server. When you type a URL into your browser (for example, http://downloadfullfree.com/p/index.php ), your browser requests the page from the web server and the web server sends the page back.

Browser Resolves the Domain Name to an IP Address

Your web browser first needs to know which IP address the domain name downloadfullfree.com resolves to. If it doesn't already have this information stored in it's cache, it requests the information from one or more DNS servers (via the internet).

The DNS server tells the browser which IP address the domain name resolves to (and therefore, where the website is located).

Browser Requests the Full URL

Now that the web browser knows which IP address the website is located at, it can request the full URL from the web server.

The web server responds by sending back the requested page. If the page doesn't exist (or another error occurs), it will send back the appropriate error message.

Browser Requests the Full URL(Cont.)

Your web browser receives the page and renders it as required.

When referring to web browsers and web servers in this manner, we usually refer to them as a client (web browser) and a server (web server).

Multiple Websites

A web server can (and usually does) contain more than one website. In fact, many hosting companies host hundreds, or even thousands of websites on a single web server.

Each website is usually assigned a unique IP address which distinguishes it from other websites on the same machine. This IP address is also what the DNS server uses to resolve the domain name.

It is also possible to configure multiple websites without using different IP addresses using host headers and/or different ports. This can be useful in a development environment and is quite easy to do.

Page Not Found

If the requested page isn't found, the web server sends the appropriate error code/message back to the client..

You can create user friendly error messages, then configure your web server to display that page instead of the usual error page. This can add a nice touch to your website. How many times have you (or even worse, your visitors) encountered a plain white page with some cryptic error message on it?

It's very easy to create custom error pages, then configure your web server to use them.

Default Documents

If you've ever created a website, you may have found that if you have an "index" file (index.html for example), you don't need to specify the name of the file. For example, the following URLs both load the same page: http://example.com/index.html

In this example, index.html is the default document. You can configure your web server so that any file name can be the default document.

For example, you could configure your web server to use index.cfm in the event no filename has been specified, or if you use PHP, index.php. You can even specify different default documents for different directories if you like.

SSL Certificates

You can apply SSL certificates against a website via the web server. First you need to generate the certificate either by yourself (i.e. using a certificate generator), or by a Certificate Authority (CA). Then, once it has been generated, you apply it to your website via your web server. Applying an SSL certificate to a website is a straight forward task.

SSL Certificates(Cont.)

Once you've applied an SSL certificate against a website, you can navigate it using HTTPS (as opposed to HTTP). HTTPS encrypts any data that is transferred over the internet. This reduces the possibility of some malicious person being able to read your users' sensitive information.

To navigate a website using HTTPS, you simply replace the HTTP with HTTPS at the start of the URL in your browsers' location bar ("https://downloadfullfree.com")