Web Server Sun Peng 2005 @ICU What is server - Question First thing first! We need a definition: What is a server? ? What is server - Answer (1) A computer software application that carries out some task (i.e. provides a service) on behalf of another piece of software called a client. The physical computer on which such software runs. What is server - Answer (2) Sometimes this dual usage can lead to confusion, so in the following presentation, the web server means the software, such as the Apache HTTP server, which manages the delivery of web page components in response to requests from web browser clients. First Web Server (1) In 1989 Tim Berners-Lee proposed to CERN a new project, a hypertext system. Tim Berners-Lee wrote two programs: a wwwbrowser WorldWideWeb and the world's first web server, which ran on NeXTSTEP. First Web Server (2) How a web server works Every web server program operates by accepting HTTP requests from the network, and providing an HTTP response to the requester. HTTP - the language HTTP is the protocol that web servers and browsers used to communicate over the Internet. It is a request and response protocol--the client makes a request and the server responds to it HTTP uses reliable TCP connections, by default on TCP port 80. The first version of HTTP was HTTP/0.9, which was then overridden by HTTP/1.0. The current version is HTTP/1.1. HTTP Request An HTTP request consists of three components: Method-URI-Protocol/Version Request headers Entity body HTTP Request Example POST /servlet/default.jsp HTTP/1.1 Accept: text/plain; text/html Accept-Language: en-gb Connection: Keep-Alive Host: localhost Referer: http://localhost/ch8/SendDetails.htm User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows 98) Content-Length: 33 Content-Type: application/x-www-form-urlencoded Accept-Encoding: gzip, deflate HTTP Response an HTTP response also consists of three parts: Protocol-Status code-Description Response headers Entity body HTTP Response Example HTTP/1.1 200 OK Server: Microsoft-IIS/4.0 Date: Mon, 3 Jan 1998 13:13:33 GMT Content-Type: text/html Last-Modified: Mon, 11 Jan 1998 13:23:42 GMT Content-Length: 112 <html> <head> <title>HTTP Response Example</title></head><body> Welcome to Brainy Software </body> </html> Are you familiar with this page? The Basic Process Behind the screen – B&S (1) The browser breaks the URL into three parts: The protocol ("http") The server name ("bigbear.icu.ac.kr") The file name ("~iko/index.htm") The browser communicates with a name server to translate the server name " bigbear.icu.ac.kr " into an IP Address, which used to connect to the server machine. Behind the screen – B&S (2) The browser then forms a connection to the server at that IP address on port 80. Following the HTTP protocol, the browser send a GET request to the server, asking for the file "http://bigbear.icu.ac.kr/~iko/index.html." Behind the screen – B&S (3) The server now responds to the browser's requests. It verifies that the given address exists finds the necessary files runs the appropriate scripts exchanges cookies if necessary returns the results back to the browser Behind the screen – B&S (4) The browser read the HTML tags and formatted the page onto your screen. Other Duties of Web Server - (1) A Web server should distinguish various errors and data types. A Web server must designate the proper code for any sort of internal error and send that back to the browser immediately after it occurs. It also has to distinguish between various elements on a Web page (such as .GIFs, JPEGS and audio files) so that the browser knows which files are saved in which format. Other Duties of Web Server - (2) Depending on the site's function, a Web server may also have numerous additional tasks to handle, including logging statistics from database, handling security and encryption, serving images for other sites (for banners, …) generating dynamic content, managing e-commerce functions. etc. Category: Two world Commercial Free List Free Apache httpd Commercial Abyss Web Server Abyss Web Server X1 Caudium Cherokee HTTP Server Lighttpd X2 BEA WebLogic Zeus Web Server Microsoft Internet Information Services Redhat Stronghold Sun ONE Which is better? I don’t know. But… Software is like sex. It's better when it's free. Who said it? Not me….. By Linus Torvalds, the father of Linux It is! Apache is by far the most common software, with over 69% market share according to the June 2005 Netcraft Web Server Survey Microsoft 20.26% Sun 2.85% Zeus 0.90% Source: http://news.netcraft.com/archives/2005/07/01/july_2005_web_server_survey.html Apache Apache is the web server component of the popular web server application stack called LAMP (Linux, Apache, MySQL, PHP/Perl). Apache was built by a group of open-source programmers and is often used because of its outstanding performance, strong security features and the fact that it is free. Apache – History Before Apache: In February of 1995, the most popular server software is NCSA httpd. Using NCSA httpd 1.3 as a base, a group of programmer continued the development. Apache 1.0 was released on Dec. 1, 1995. Apache 2.0.15 (alpha) was released on 28,March,2001 Latest stable version: Apache 2.0.54 Apache – Features (1) powerful, flexible, HTTP/1.1 compliant web server implements the latest protocols, including HTTP/1.1 highly configurable and extensible with third-party modules can be customized by writing 'modules' using the Apache module API provides full source code and comes with an unrestrictive license runs on Linux, Windows, Netware 5.x and above, OS/2, and most versions of Unix, etc Apache – Features (2) implements many frequently requested features, including: DBM databases for authentication Customized responses to errors and problems Multiple Directory Index directives Unlimited flexible URL rewriting and aliasing Content negotiation Virtual Hosts Configurable Reliable Piped Logs Reference RFC 2616—The Request for Comments document that defines the HTTP 1.1 protocol. Apache FAQ http://httpd.apache.org/docs/misc/FAQ.html Any questions? Please…….. Thank you! Bye~~!