12
  Año 2010  Author: RosaM Romero Serrano Web Servers Unit 3 

3.Web Servers

Embed Size (px)

Citation preview

Page 1: 3.Web Servers

8/8/2019 3.Web Servers

http://slidepdf.com/reader/full/3web-servers 1/12

 

 Año 2010

 Author: RosaM Romero Serrano

Web Servers

Unit 3 

Page 2: 3.Web Servers

8/8/2019 3.Web Servers

http://slidepdf.com/reader/full/3web-servers 2/12

 

1

Web Servers

Unit 3

What’s a Web server  

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.

Types of web servers

Some important web servers are:   Apache  http://www.apache.org,  http://en.wikipedia.org/wiki/Apache_HTTP_Server 

  IIS http://www.iis.net/ , http://en.wikipedia.org/wiki/Internet_Information_Services 

  Cherokee http://www.cherokee-project.com/ 

Page 3: 3.Web Servers

8/8/2019 3.Web Servers

http://slidepdf.com/reader/full/3web-servers 3/12

  2

    I   n   t   r   o

    d   u   c   t    i   o   n   t   o    W   e    b    A   p   p    l    i   c   a   t    i   o   n   s    |    A    ñ   o   2   0   1   0

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/ 

Installing a local Web Server

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:

  Installing IIS server, the web server of Microsoft

Page 4: 3.Web Servers

8/8/2019 3.Web Servers

http://slidepdf.com/reader/full/3web-servers 4/12

 

3

  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…). 

We can download software and manuals online http://www.apache.org/ 

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 onlinehttp://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:

  AppServ 2.5.10   http://www.appservnetwork.com/  that installs Apache v 2.2.8, PHP v

5.2.6, MySQL v 5.0.51b and phpMyAdmin v.2.10.3

  WAMPServer 2.0ihttp://www.wampserver.com/en/ that installs

Apache v 2.2.11, PHP v 5.3, MySQL v 5.1.36 and phpMyAdmin 3.2.0.1

  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/ 

We’re going to install WAMPP Server.

Installation of WAMPP Server

Once the file is downloaded from oficial web page, we’ll run the apropriate .EXE file 

The following screen will appear

Page 5: 3.Web Servers

8/8/2019 3.Web Servers

http://slidepdf.com/reader/full/3web-servers 5/12

  4

    I   n   t   r   o

    d   u   c   t    i   o   n   t   o    W   e    b    A   p   p    l    i   c   a   t    i   o   n   s    |    A    ñ   o   2   0   1   0

 

We’ll click on “Next >” 

We’ll click on “I accept the agreement”, accepting the license agreement and then “Next >” 

Page 6: 3.Web Servers

8/8/2019 3.Web Servers

http://slidepdf.com/reader/full/3web-servers 6/12

 

5

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.

Page 7: 3.Web Servers

8/8/2019 3.Web Servers

http://slidepdf.com/reader/full/3web-servers 7/12

  6

    I   n   t   r   o

    d   u   c   t    i   o   n   t   o    W   e    b    A   p   p    l    i   c   a   t    i   o   n   s    |    A    ñ   o   2   0   1   0

 

While processing we’ll be asking about desirable browser:

In the picture Internet Explorer is choosen.

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.

Page 8: 3.Web Servers

8/8/2019 3.Web Servers

http://slidepdf.com/reader/full/3web-servers 8/12

 

7

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’ll know that the server is running by

looking at the apropriate icon in Windows

Notifying area 

If we click on this icon the following menu

will appear:

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 publicationdirectory (www directory) or phpMyAdmin in order to manage MySQL database.

Page 9: 3.Web Servers

8/8/2019 3.Web Servers

http://slidepdf.com/reader/full/3web-servers 9/12

  8

    I   n   t   r   o

    d   u   c   t    i   o   n   t   o    W   e    b    A   p   p    l    i   c   a   t    i   o   n   s    |    A    ñ   o   2   0   1   0

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.

You’ll know all them in other subject of 2nd course 

Apache configuration files

Apache configuration file is httpd.conf . We can see its content by selecting the following popup

submenu in WAMP icon:

This file is a text file with a particular syntax. The main lines are:

  ServerRoot "D:/wamp/bin/apache/apache2.2.11"It tells us where the server is installed

Page 10: 3.Web Servers

8/8/2019 3.Web Servers

http://slidepdf.com/reader/full/3web-servers 10/12

 

9

  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

  ServerName localhostIt indicates the name of our server

  DocumentRoot "D:/wamp/www/"It indicates the directory where we’ll put the content of 

our web site. All the contents here will be shown with the browser if possible.

  Each <directory …> </directory> indicates the permissons given by the server to access this

directory.

  Etc.

PHP configuration files

PHP configuration file is php.ini. We can see its content by selecting the following popup submenu in

WAMP icon:

Page 11: 3.Web Servers

8/8/2019 3.Web Servers

http://slidepdf.com/reader/full/3web-servers 11/12

  10

    I   n   t   r   o

    d   u   c   t    i   o   n   t   o    W   e    b    A   p   p    l    i   c   a   t    i   o   n   s    |    A    ñ   o   2   0   1   0

 

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 files

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

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.

Page 12: 3.Web Servers

8/8/2019 3.Web Servers

http://slidepdf.com/reader/full/3web-servers 12/12

 

11