World Wide Web Wee San Lee weesancs ucr

World Wide Web Wee. San Lee <weesan@cs. ucr. edu> http: //www. cs. ucr. edu/~weesan/cs 183/

Roadmap n n n n Introduction HTTP URL HTML CGI Apache Server Installation Squid Cache Server Q&A

Introduction n Invented by Tim Berners-Lee in 1989/1990 Client-server architecture Servers q n Apache, Netscape Enterprise Server, MS IIS, etc Clients q GUI n q Mosaic, Netscape, Mozilla, Firefox, Opera, Konqueror, Epiphany, IE, Safari, etc Text n Link, wget, emacs, telnet, etc

HTTP n n Hypertext Transfer Protocol Listen on port 80 or http (/etc/services) q $ grep " 80/tcp" /etc/services n n http 80/tcp www RFC 2068 defines HTTP/1. 0 RFC 2616 defines HTTP/1. 1 Built on top of TCP

HTTP (cont) n n n n $ telnet www. cs. ucr. edu 80 Trying 138. 23. 169. 15. . . Connected to www. cs. ucr. edu. Escape character is '^]'. GET / HTTP/1. 0 HTTP/1. 1 200 OK Date: Mon, 16 Jul 2007 20: 47: 38 GMT Server: Apache/2. 2. 3 (Cent. OS) Last-Modified: Mon, 16 Jul 2007 20: 08: 44 GMT ETag: "889 f 0 f-d 5 -71 bab 00" Accept-Ranges: bytes Content-Length: 213 Connection: close Content-Type: text/html; charset=UTF-8 …

URL n n Uniform Resource Locator Eg. q q q http: //www. cs. ucr. edu: 80/~weesan/index. html http – protocol/application www. cs. ucr. edu – hostname 80 – port ~weesan/ - directory Index. html - filename

URL (cont) n Other protocols q file n q ftp: //ftp. slackware. com/pub/slackware-12. 0/ https n q file: //etc/passwd https: //www. cs. ucr. edu/ mailto n mailto: weesan@cs. ucr. edu

HTML n n n Hypertext Markup Language Eg. <head> q n n </head> <body> q n <title>A sample HTML</title> <a href=“mailto: weesan@cs. ucr. edu”>Me</a> </body>

CGI n n n Common Gateway Interface A way to communicate with external programs and generate pages dynamically Example of external scripts/programs: q n Perl, PHP, Python, Ruby, Bash, C/C++, Cobol, etc Servers support plugins for performance, eg. q q q libphp 4. so libphp 5. so libperl. so

Apache Server Installation n http: //www. apache. org/ $ yum install httpd Files are distributed all over the places q q q q /etc/httpd/conf/httpd. conf /usr/sbin/httpd /usr/sbin/apachectl /var/www/html/ /var/www/cgi-bin/ /var/log/httpd/access_log /var/log/httpd/error_log

Apache Server Installation (cont) n To start the httpd server q n To restart the httpd server q n $ /etc/init. d/httpd restart To stop the httpd server q n $ /etc/init. d/httpd start $ /etc/init. d/httpd stop To start the httpd server on reboot q $ chkconfig --level 2345 httpd on

Squid Cache Server n n n http: //www. squid-cache. org/ A free version spawned from Harvest Cache Project from USC, which became Net. Cache, and 8 months later, it was acquired by Net. App Caches objects locally q q n n n Saves bandwidth Reduces latency Fast, not process forking for new connections Supports Hierarchy Caching Listen on port 3128

Squid Cache Server (cont) n n n n $ telnet cache. cs. ucr. edu 3128 Trying cache. cs. ucr. edu. . . Connected to cache. cs. ucr. edu. Escape character is '^]'. GET http: //www. cs. ucr. edu/~weesan/cs 183/login. php HTTP/1. 0 Host: www. cs. ucr. edu HTTP/1. 0 200 OK Date: Thu, 08 May 2008 07: 11: 19 GMT Server: Apache/2. 2. 3 (Cent. OS) X-Powered-By: PHP/5. 1. 6 Content-Type: text/html; charset=UTF-8 X-Cache: MISS from cache. cs. ucr. edu Via: 1. 0 cache. cs. ucr. edu: 3128 (squid/2. 6. STABLE 14) Proxy-Connection: close …

Squid Cache Server (cont) . edu. com . net GET http: //www. cs. ucr. edu HTTP/1. 0

Squid Cache Server (cont) n Accelerator Mode q q n Reverse Proxy To make web server faster for static pages Transparent Caching q q Uses iptables Configuration-free from clients

Squid Cache Server (cont) n To create swap directories q q n To run Squid Cache Server q n $ Run. Cache To reload the configuration q n $ squid –z Run only once!!! $ squid -k reconfiguration To rotate the log files q $ squid -k rotate

Reference n LAH q n Apache Web Server q n Ch 21: Web Hosting and Internet Servers http: //www. apache. org/ Squid Cache Server q http: //www. squid-cache. org/
- Slides: 17