Anda di halaman 1dari 21

Internet Engineering

Web Servers

Introduction

Company needs to provide various web services


Hosting intranet applications Company web site Various internet applications


First we have a look at what http protocol is Then we talk about Apache web server as leading web server application

Therefore there is a need to provide http server


The World Wide Web (WWW)


Global hypertext system Initially developed in 1989 By Tim Berners Lee at the European Laboratory for Particle Physics, CERN in Switzerland. To facilitate an easy way of sharing and editing research documents among a geographically dispersed groups of scientists. In 1993, started to grow rapidly Mainly due to the NCSA developing a Web browser called Mosaic (an X Window-based application)

First graphical interface to the Web More convenient browsing Flexible way people can navigate through worldwide resources in the Internet and retrieve them

Web Servers

Definitions

A computer, responsible for accepting HTTP requests from clients, and serving them Web pages. A computer program that provides the above mentioned functionality.
Accepting HTTP requests from the network Providing HTTP response to the requester

Common features

Typically consists of an HTML Client requests/Server responses

Usually capable of logging

Web Servers cont.

Returned content

Static

Comes from an existing file Dynamically generated by some other program/script called by the Web server.

Dynamic

Path translation

Translate the path component of a URL into a local file system resource

Path specified by the client is relative to the servers root dir

HTTP 1.1 servers

To comply with HTTP 1.1, servers must:

Requiring the Host: Header. Without it server must response with something like below:
HTTP/1.1 400 Bad Request Content-Type: text/html Content-Length: 111 <html><body> <h2>No Host: header received</h2> HTTP 1.1 requests must include the Host: header. </body></html>

Accepting absolute URLs

GET http://www.somehost.com/path/file.html HTTP/1.2

Chunked transfer

HTTP 1.1 servers (cont.)

Persistent Connections and the "Connection: close" Header Using the "100 Continue" Response The Date: Header for caching Handling Requests with If-Modified-Since: or IfUnmodified-Since: Headers
HTTP/1.1 304 Not Modified Date: Fri, 31 Dec 1999 23:59:59 GMT [blank line here]

Supporting the GET and HEAD methods Supporting HTTP 1.0 Requests

First Web Server

Berners-Lee wrote two programs


A browser called WorldWideWeb The worlds first Web server, which ran on NeXSTEP

The machine is on exhibition at CERNs public museum

Most Famous Web Servers

Apache HTTP Server from Apache Software Foundation Internet Information Services (IIS) from Microsoft Sun Java Web Server from Sun Microsystems

Formerly Sun ONE Web Server, iPlanet Web Server, and Netscape Enterprise Server

Zeus Web Server from Zeus Technology

Web Servers Usage Statistics

The most popular Web servers, used for public Web sites, are tracked by Netcraft Web Server Survey

Details given by Netcraft Web Server Reports

Apache is the most popular since April 1996 Currently (February 2006) about

66.64% Apache 25.11% Microsoft (IIS, PWS, etc.) 0.73% Zeus 0.67% Sun (Java Web Server, Netscape Enterprise, iPlanet, )

Web Servers Usage Statistics cont.


Total Sites August 1995 - February 2006

Market Share for Top Servers August 1995 - February 2006

Totals for Active Servers June 2000 - February 2006

Apache web server features and functions

Caching Content negotiation

A resource may be available in several different representations. For example, it might be available in different languages or different media types, or a combination. One way of selecting the most appropriate choice is to give the user an index page, and let them select. However it is often possible for the server to choose automatically by the help of request headers:
Accept-Language: fr; q=1.0, en; q=0.5 Accept: text/html; q=1.0, text/*; q=0.8, image/gif; q=0.6, image/jpeg; q=0.6, image/*; q=0.5, */*; q=0.1

Apache web server features and functions (cont.)

Log files

In order to effectively manage a web server, it is necessary to get feedback about the activity and performance of the server as well as any problems that may be occurring Error log:

[Wed Oct 11 14:32:52 2000] [error] [client 127.0.0.1] client denied by server configuration: /export/home/live/ap/htdocs/test
Common log format:

Access log:

127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326 127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326 "http://www.example.com/start.html" "Mozilla/4.08 [en] (Win98; I ;Nav)"

Combined log format:

Apache web server features and functions (cont.)

Mapping URLs to file system locations:


DocumentRoot Alias directive:


Alias /docs /var/web the URL http://www.example.com/docs/dir/file.html will be served from /var/web/dir/file.html. ScriptAliasMatch ^/~([a-zA-Z0-9]+)/cgi-bin/(.+) /home/$1/cgibin/$2 will map a request to http://example.com/~user/cgibin/script.cgi to the path /home/user/cgi-bin/script.cgi and will treat the resulting file as a CGI script http://www.example.com/~user/file.html

AliasMatch:

User Directories:

Apache web server features and functions (cont.)

Mapping URLs to file system locations:

URL redirection:

Redirect permanent /foo/ http://www.example.com/bar/ Apache also allows you to bring remote documents into the URL space of the local server. This technique is called reverse proxying because the web server acts like a proxy server by fetching the documents from a remote server and returning them to the client. ProxyPass /foo/ http://internal.example.com/bar/

Reverse proxy:

Mod_speling for file not found errors

Apache web server features and functions (cont.)

Access control to filesystem

<Directory /> Order Deny,Allow Deny from all </Directory> Directory /usr/users/*/public_html> Order Deny,Allow Allow from all </Directory>

Apache web server features and functions (cont.)

SSI (Server Side Includes)

SSI (Server Side Includes) are directives that are placed in HTML pages, and evaluated on the server while the pages are being served. They let you add dynamically generated content to an existing HTML page, without having to serve the entire page via a CGI program, or other dynamic technology. <!--#config timefmt="%A %B %d, %Y" --> Today is <!--#echo var="DATE_LOCAL" --> <!--#include virtual="/footer.html" --> <!--#include virtual="/cgi-bin/counter.pl" -->

Apache web server features and functions (cont.)

Virtual hosting

The term Virtual Host refers to the practice of running more than one web site (such as www.company1.com and www.company2.com) on a single machine. Virtual hosts can be "IP-based", meaning that you have a different IP address for every web site or "name-based", meaning that you have multiple names running on each IP address. The fact that they are running on the same physical server is not apparent to the end user.

Apache web server features and functions (cont.)

IP based Virtual hosting the server must have a different IP address for each IP-based virtual host. This can be achieved by the machine having several physical network connections <VirtualHost www.smallco.com> ServerAdmin webmaster@mail.smallco.com DocumentRoot /groups/smallco/www ServerName www.smallco.com ErrorLog /groups/smallco/logs/error_log TransferLog /groups/smallco/logs/access_log </VirtualHost> <VirtualHost www.baygroup.org> ServerAdmin webmaster@mail.baygroup.org DocumentRoot /groups/baygroup/www ServerName www.baygroup.org ErrorLog /groups/baygroup/logs/error_log TransferLog /groups/baygroup/logs/access_log </VirtualHost>

Apache web server features and functions (cont.)

Name based Virtual hosting HTTP 1.1 compliant clients needed; i.e. Host header should be included in request NameVirtualHost *:80 <VirtualHost *:80> ServerName www.domain.tld ServerAlias domain.tld *.domain.tld DocumentRoot /www/domain </VirtualHost> <VirtualHost *:80> ServerName www.otherdomain.tld DocumentRoot /www/otherdomain </VirtualHost>

References

http://www.jmarshall.com/easy/http/ TCP/IP Tutorial and Technical Overview, Rodriguez, Gatrell, Karas, Peschke, IBM redbooks, August 2001 Wikipedia, the free encyclopedia Apache: The Definitive Guide, 2nd edition, Ben Laurie, Peter Laurie, OReilly, February 1999 Webmaster in a nutshell, 1st edition, Stephen Spainhour, Valerie Quercia, OReilly, October 1996 Netcraft: February 2006 Web Server Survey

Anda mungkin juga menyukai