Web Servers: Unit 3
Web Servers: Unit 3
Unit 3
Año 2010
Author: RosaM Romero Serrano
Web Servers
Unit 3
A web server is a computer program that delivers (serves) content, such as web pages, using the
Hypertext Transfer Protocol (HTTP), over the World Wide Web. The term web server can also refer to
the computer or virtual machine running the program. [Wikipedia]
The primary function of a web server is to deliver web pages to clients. This means delivery of HTML
documents and any additional content that may be included by a document, such as images, style
sheets (CSS) and JavaScripts.
A client, commonly a web browser or web crawler, initiates communication by making a request for
a specific resource using HTTP and the server responds with the content of that resource, or an error
message if unable to do so.
The contents sent by clients can be not only text information but web forms, including uploading of
files.
Many generic web servers also support server-side scripting, e.g., Apache HTTP Server and PHP.
Usually, this functionality is used to create HTML documents on-the-fly as opposed to return fixed
documents. This is referred to as dynamic and static content respectively. The former is primarily
used for retrieving and/or modifying information in databases. The latter is, however, typically much
faster and easily cached.
1
Other servers, simplier but faster are:
Lighttpd http://www.lighttpd.net/
Thttpd http://en.wikipedia.org/wiki/Thttpd
In order to compare several web servers Wikipedia gives us the following chart
Very interesting too is the information given in the following link where statistics about different web
server usage is shown: http://greatstatistics.com/
From now on we’ll need to have installed a web server in our computer, so we’re going to install it in
a windows environment.
Possibilities:
2
Installing Apache, multiplatform and open source web server
We’re going to install Apache in our PC, with any Windows version we have (Windows XP, Vista,
Windows 7…).
As we want to get access to databases, we need to install PHP, that will allow us to create necessary
structures in programmation in order to work with databases.
PHP is a programming language that we aren’t going to learn in this course but widely used in web.
We can download the software and manuals online http://php.net/index.php
With PHP we can work with a lot of databases, but we choose MySQL, an Open Source database. We
can find the software and manuals inhttp://www.mysql.com/
In order to have a complete web server that is able to work with web applications we need to install
this three programs. The separated installation or this 3 programs could cause some trouble because
of versions incompatibility. Fortunately there are some utilities that allow us to automatically install
Apache, PHP and MySQL and leave them perfectly configurated and ready to use. Examples of these
utilities are:
XAMPServer 1.7.3http://www.apachefriends.org/en/xampp-
windows.html that installs Apache 2.2.14, MySQl 5.1.41, PHP 5.3.1 and phpMyAdmin 3.2.4
Other alternatives similar to WAMP, are LAMP (Linux, Apache, MySQL and PHP) and LAPP
(Linux, Apache, PHP and PostgreSQL)
Bitnami: It’s an open source project than allows you locally or by means of a virtual machine
to install stacks of software or web applications easily. We can get more information in:
http://bitnami.org/
Once the file is downloaded from oficial web page, we’ll run the apropriate .EXE file
3
We’ll click on “Next >”
We’ll click on “I accept the agreement”, accepting the license agreement and then “Next >”
Introduction to Web Applications | Año 2010
4
In this window we’ll select the directory where we want to install it. By default “c:\wamp” is
choosen. We’ll click on “Next >”
We’ll select the desired options and then we’ll click on “Next >”
When finished a resume of the settings selected will appear. If we agree we’ll click on “Install” button
in order to begin installation process.
5
While processing we’ll be asking about desirable browser:
When finished, some additional information will be required such as email configuration for PHP.
We’ll leave default options as we aren’t going to use it now. Introduction to Web Applications | Año 2010
6
When the whole process finishes the following window will appear. We can choose if launching
application now or later. Then we’ll click on “Finish”.
We must initiate all services by clicking on “Start All Services” and then “Put Online”. If the icon
becomes red or yellow means that some trouble has happened. We can investigate the problem by
looking at the log files of the WAMP server or the Event Viewer of the Operating System.
From this popup menu we can access the different configuration options of Apache, PHP and MySQL,
in addition to directly accessing the main page of our WAMPP server (localhost), the web publication
directory (www directory) or phpMyAdmin in order to manage MySQL database.
7
We’ll know if our server is appropriately running when by writing “localhost” on our brower’s
navigation bar the following page appears:
Configuration files
Although programs like WAMP give us all the applications configurated, it’s important to know what
the configuration files are for each application installed.
Apache configuration file is httpd.conf. We can see its content by selecting the following popup
submenu in WAMP icon: Introduction to Web Applications | Año 2010
This file is a text file with a particular syntax. The main lines are:
8
Listen 80It shows the IP port where the server listens to the requests
LoadModule php5_module "D:/wamp/bin/php/php5.3.0/php5apache2_2.dll" It indicates
that the PHP5 module is installed and where it is. We can see modules installed by selecting
the following submenu in the WAMP icon
PHP configuration file is php.ini. We can see its content by selecting the following popup submenu in
WAMP icon:
9
This file is a text file with a particular syntax. As it’s a bit complicated to understand it outside the
programming environment I recommend you to visit http://www.php.net/manual/en/ini.php
MySQL configuration file is my.ini. We can see its content by selecting the following popup submenu
in WAMP icon:
Other file which is important is config.inc.php inside phpmyadmin installation directory. It’s
Introduction to Web Applications | Año 2010
important because the information in this file and the information in the database must be the same.
Any changes made in only one side will cause some trouble.
10
11