Published on

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide


  1. 1. Internet Engineering Web Servers
  2. 2. Introduction <ul><li>Company needs to provide various web services </li></ul><ul><ul><li>Hosting intranet applications </li></ul></ul><ul><ul><li>Company web site </li></ul></ul><ul><ul><li>Various internet applications </li></ul></ul><ul><li>Therefore there is a need to provide http server </li></ul><ul><ul><li>First we have a look at what http protocol is </li></ul></ul><ul><ul><li>Then we talk about Apache web server as leading web server application </li></ul></ul>
  3. 3. The World Wide Web (WWW) <ul><li>Global hypertext system </li></ul><ul><li>Initially developed in 1989 </li></ul><ul><ul><li>By Tim Berners Lee at the European Laboratory for Particle Physics, CERN in Switzerland. </li></ul></ul><ul><ul><li>To facilitate an easy way of sharing and editing research documents among a geographically dispersed groups of scientists. </li></ul></ul><ul><li>In 1993, started to grow rapidly </li></ul><ul><ul><li>Mainly due to the NCSA developing a Web browser called Mosaic (an X Window-based application) </li></ul></ul><ul><ul><ul><li>First graphical interface to the Web  More convenient browsing </li></ul></ul></ul><ul><ul><ul><li>Flexible way people can navigate through worldwide resources in the Internet and retrieve them </li></ul></ul></ul>
  4. 4. Web Servers <ul><li>Definitions </li></ul><ul><ul><li>A computer, responsible for accepting HTTP requests from clients, and serving them Web pages. </li></ul></ul><ul><ul><li>A computer program that provides the above mentioned functionality. </li></ul></ul><ul><li>Common features </li></ul><ul><ul><li>Accepting HTTP requests from the network </li></ul></ul><ul><ul><li>Providing HTTP response to the requester </li></ul></ul><ul><ul><ul><li>Typically consists of an HTML </li></ul></ul></ul><ul><ul><li>Usually capable of logging </li></ul></ul><ul><ul><ul><li>Client requests/Server responses </li></ul></ul></ul>
  5. 5. Web Servers cont. <ul><li>Returned content </li></ul><ul><ul><li>Static </li></ul></ul><ul><ul><ul><li>Comes from an existing file </li></ul></ul></ul><ul><ul><li>Dynamic </li></ul></ul><ul><ul><ul><li>Dynamically generated by some other program/script called by the Web server. </li></ul></ul></ul><ul><li>Path translation </li></ul><ul><ul><li>Translate the path component of a URL into a local file system resource </li></ul></ul><ul><ul><ul><li>Path specified by the client is relative to the server’s root dir </li></ul></ul></ul>
  6. 6. HTTP 1.1 servers <ul><li>To comply with HTTP 1.1, servers must: </li></ul><ul><ul><li>Requiring the Host: Header. Without it server must response with something like below: </li></ul></ul><ul><ul><ul><li>HTTP/1.1 400 Bad Request </li></ul></ul></ul><ul><ul><ul><li>Content-Type: text/html </li></ul></ul></ul><ul><ul><ul><li>Content-Length: 111 </li></ul></ul></ul><ul><ul><ul><li><html><body> <h2>No Host: header received</h2> HTTP 1.1 requests must include the Host: header. </body></html> </li></ul></ul></ul><ul><ul><li>Accepting absolute URL’s </li></ul></ul><ul><ul><ul><li>GET http://www.somehost.com/path/file.html HTTP/1.2 </li></ul></ul></ul><ul><ul><li>Chunked transfer </li></ul></ul>
  7. 7. HTTP 1.1 servers (cont.) <ul><li>Persistent Connections and the &quot;Connection: close&quot; Header </li></ul><ul><li>Using the &quot;100 Continue&quot; Response </li></ul><ul><li>The Date: Header for caching </li></ul><ul><li>Handling Requests with If-Modified-Since: or If-Unmodified-Since: Headers </li></ul><ul><ul><ul><li>HTTP/1.1 304 Not Modified </li></ul></ul></ul><ul><ul><ul><li>Date: Fri, 31 Dec 1999 23:59:59 GMT </li></ul></ul></ul><ul><ul><ul><li>[blank line here] </li></ul></ul></ul><ul><li>Supporting the GET and HEAD methods </li></ul><ul><li>Supporting HTTP 1.0 Requests </li></ul>
  8. 8. First Web Server <ul><li>Berners-Lee wrote two programs </li></ul><ul><ul><li>A browser called WorldWideWeb </li></ul></ul><ul><ul><li>The world’s first Web server, which ran on NeXSTEP </li></ul></ul><ul><ul><ul><li>The machine is on exhibition at CERN’s public museum </li></ul></ul></ul>
  9. 9. Most Famous Web Servers <ul><li>Apache HTTP Server from Apache Software Foundation </li></ul><ul><li>Internet Information Services (IIS) from Microsoft </li></ul><ul><li>Sun Java Web Server from Sun Microsystems </li></ul><ul><ul><li>Formerly Sun ONE Web Server, iPlanet Web Server, and Netscape Enterprise Server </li></ul></ul><ul><li>Zeus Web Server from Zeus Technology </li></ul>
  10. 10. Web Servers Usage – Statistics <ul><li>The most popular Web servers, used for public Web sites, are tracked by Netcraft Web Server Survey </li></ul><ul><ul><li>Details given by Netcraft Web Server Reports </li></ul></ul><ul><li>Apache is the most popular since April 1996 </li></ul><ul><li>Currently (February 2006) about </li></ul><ul><ul><li>66.64%  Apache </li></ul></ul><ul><ul><li>25.11%  Microsoft (IIS, PWS, etc.) </li></ul></ul><ul><ul><li>0.73%  Zeus </li></ul></ul><ul><ul><li>0.67%  Sun (Java Web Server, Netscape Enterprise, iPlanet, …) </li></ul></ul>
  11. 11. 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
  12. 12. Apache web server features and functions <ul><li>Caching </li></ul><ul><li>Content negotiation </li></ul><ul><ul><li>A resource may be available in several different representations. </li></ul></ul><ul><ul><li>For example, it might be available in different languages or different media types, or a combination. </li></ul></ul><ul><ul><li>One way of selecting the most appropriate choice is to give the user an index page, and let them select. </li></ul></ul><ul><ul><li>However it is often possible for the server to choose automatically by the help of request headers: </li></ul></ul><ul><ul><ul><li>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 </li></ul></ul></ul>
  13. 13. Apache web server features and functions (cont.) <ul><li>Log files </li></ul><ul><ul><li>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 </li></ul></ul><ul><ul><li>Error log: </li></ul></ul><ul><ul><ul><li>[Wed Oct 11 14:32:52 2000] [error] [client] client denied by server configuration: /export/home/live/ap/htdocs/test </li></ul></ul></ul><ul><ul><li>Access log: </li></ul></ul><ul><ul><ul><li>Common log format: </li></ul></ul></ul><ul><ul><ul><ul><li> - frank [10/Oct/2000:13:55:36 -0700] &quot;GET /apache_pb.gif HTTP/1.0&quot; 200 2326 </li></ul></ul></ul></ul><ul><ul><ul><li>Combined log format: </li></ul></ul></ul><ul><ul><ul><ul><li> - frank [10/Oct/2000:13:55:36 -0700] &quot;GET /apache_pb.gif HTTP/1.0&quot; 200 2326 &quot;http://www.example.com/start.html&quot; &quot;Mozilla/4.08 [en] (Win98; I ;Nav)&quot; </li></ul></ul></ul></ul>
  14. 14. Apache web server features and functions (cont.) <ul><li>Mapping URLs to file system locations: </li></ul><ul><ul><li>DocumentRoot </li></ul></ul><ul><ul><li>Alias directive: </li></ul></ul><ul><ul><ul><li>Alias /docs /var/web </li></ul></ul></ul><ul><ul><ul><li>the URL http://www.example.com/docs/dir/file.html will be served from /var/web/dir/file.html. </li></ul></ul></ul><ul><ul><li>AliasMatch: </li></ul></ul><ul><ul><ul><li>ScriptAliasMatch ^/~([a-zA-Z0-9]+)/cgi-bin/(.+) /home/$1/cgi-bin/$2 </li></ul></ul></ul><ul><ul><ul><li>will map a request to http://example.com/~user/cgi-bin/script.cgi to the path /home/user/cgi-bin/script.cgi and will treat the resulting file as a CGI script </li></ul></ul></ul><ul><ul><li>User Directories: </li></ul></ul><ul><ul><ul><li>http://www.example.com/~user/file.html </li></ul></ul></ul>
  15. 15. Apache web server features and functions (cont.) <ul><li>Mapping URLs to file system locations: </li></ul><ul><ul><li>URL redirection: </li></ul></ul><ul><ul><ul><li>Redirect permanent /foo/ http://www.example.com/bar/ </li></ul></ul></ul><ul><ul><li>Reverse proxy: </li></ul></ul><ul><ul><ul><li>Apache also allows you to bring remote documents into the URL space of the local server. </li></ul></ul></ul><ul><ul><ul><li>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. </li></ul></ul></ul><ul><ul><ul><li>ProxyPass /foo/ http://internal.example.com/bar/ </li></ul></ul></ul><ul><ul><li>Mod_speling for file not found errors </li></ul></ul>
  16. 16. Apache web server features and functions (cont.) <ul><li>Access control to filesystem </li></ul><ul><ul><ul><li><Directory /> Order Deny,Allow Deny from all </Directory> </li></ul></ul></ul><ul><ul><ul><li>Directory /usr/users/*/public_html> Order Deny,Allow Allow from all </Directory> </li></ul></ul></ul>
  17. 17. Apache web server features and functions (cont.) <ul><li>SSI (Server Side Includes) </li></ul><ul><ul><li>SSI (Server Side Includes) are directives that are placed in HTML pages, and evaluated on the server while the pages are being served. </li></ul></ul><ul><ul><li>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. </li></ul></ul><ul><ul><li><!--#config timefmt=&quot;%A %B %d, %Y&quot; --> Today is <!--#echo var=&quot;DATE_LOCAL&quot; --> </li></ul></ul><ul><ul><li><!--#include virtual=&quot;/footer.html&quot; --> </li></ul></ul><ul><ul><li><!--#include virtual=&quot;/cgi-bin/counter.pl&quot; --> </li></ul></ul>
  18. 18. Apache web server features and functions (cont.) <ul><li>Virtual hosting </li></ul><ul><ul><li>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. </li></ul></ul><ul><ul><li>Virtual hosts can be &quot; IP-based &quot;, meaning that you have a different IP address for every web site </li></ul></ul><ul><ul><li>or &quot; name-based &quot;, 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. </li></ul></ul>
  19. 19. Apache web server features and functions (cont.) <ul><li>IP based Virtual hosting </li></ul><ul><ul><li>the server must have a different IP address for each IP-based virtual host . </li></ul></ul><ul><ul><li>This can be achieved by the machine having several physical network connections </li></ul></ul><ul><ul><li><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> </li></ul></ul>
  20. 20. Apache web server features and functions (cont.) <ul><li>Name based Virtual hosting </li></ul><ul><ul><li>HTTP 1.1 compliant clients needed; i.e. Host header should be included in request </li></ul></ul><ul><ul><li>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> </li></ul></ul>
  21. 21. References <ul><li>http://www.jmarshall.com/easy/http/ </li></ul><ul><li>TCP/IP Tutorial and Technical Overview, Rodriguez, Gatrell, Karas, Peschke, IBM redbooks, August 2001 </li></ul><ul><li>Wikipedia , the free encyclopedia </li></ul><ul><li>Apache: The Definitive Guide, 2 nd edition, Ben Laurie, Peter Laurie, O’Reilly, February 1999 </li></ul><ul><li>Webmaster in a nutshell, 1 st edition, Stephen Spainhour, Valerie Quercia, O’Reilly, October 1996 </li></ul><ul><li>Netcraft : February 2006 Web Server Survey </li></ul>