Changes

Jump to: navigation, search

Configuring an Ubuntu Linux Based Web Server

2 bytes added, 19:03, 3 July 2007
no edit summary
It is surprising the number of people who now host their own web sites. One of the reasons for this is that doing so is now relatively easy and many people now have high speed internet connections. Linux also provides a free, enterprise level operating system with everything needed to create a web server for free (with the excpetion exception of the hardware of course).
In this chapter we will explain how to configure an Ubuntu Linux system to act as a web server.
To set up your own web site you need a computer, an operating system, a web server, a domain name, a name server and an IP address.
The computer can be any system capabable capable of running Linux. In terms of an operating system, we will assume you are using Ubuntu Linux. Ubuntu Linux supports the Apache web server which can easily be installed once Ubuntu is up and running. A domain name can be registered with any domain name registration service.
If your ISP provides static IP addresses then you will need to associate your domain with your static IP address. This is achieved using a name server. Some domain registration services will provide this service for you. If yours does not, you can create a free account at [http://www.zoneedit.com/ http://www.zoneedit.com] and use their name servers to point your domain name at your styatic static IP address.
If you do not have a static IP address (i.e. your ISP provides you with a dynamic address which changes frequently) then you can use one of a number of free services which map your dynamic IP address to your domain name. One such service is provided by [http://www.dnsExit.com/ http://www.dnsExit.com].
== Testing the Web Server ==
Once the installation is complete the next step is to verify the web server is up and running. To do this fireup fire up the web browser by clicking on the Firefox logo and enter ''127.0.0.1/apache2-default'' in the address bar (127.0.0.1 is the loop-back network address wich which tells the system to connect to the local machine). The browser should load a page that reads ''It works!''.
Congratulations, you have now installed the web server and served up what will hopefully be the first of many web pages.
The next step in setting up your web server is to configure it for your domain name. This is performed in the /etc/apache2 directory. To configure the web server open a terminal windows and change directory to /etc/apache2. In this directory you will find two sub-directories, sites-available and sites-enabled. Change directory into sites-enabled. In this directory you will find a ''default'' file which may be used as a template for your own site.
Copy the ''default'' file to a new file with name which matches your doamin domain name. For example:
<pre>
</pre>
Next it the ServerName and ServerAlias directives need to be defined so that the web server know knows which virtual host this configuration file refers to:
<pre>
If your Ubuntu Linux system is configured to use a firewall, you will need to ensure that HTTP traffic on port 80 is permitted in order for external system to be able to access your web server. Refer to the [[Basic Ubuntu Linux Firewall Configuration]] and [[Using Firestarter to Configure an Ubuntu Linux Firewall]] chapters of this book for details on configuring Ubuntu Linux Firewalls.
If the Ubuntu Linux system hosting your web server sits on a network protected by a firewall (either another computer running a firewall, or a router or wireless base station containg containing built in firewall protection) you will need to configure the firewall to forward port 80 to your web server system. The mechanism for performing this differs between firewalls and devices so check your documentation to find out how to configure port forwarding.
Once everything is configured it should be possible to enter the domain name of your web site into a browser anywhere in the world and access your web server.

Navigation menu