20-753: Fundamentals of Web Programming 1 Lecture 11: Web Server Case Study Fundamentals of Web Programming Lecture 11: Web Server Case Study
20-753: Fundamentals of Web Programming 2 Lecture 11: Web Server Case Study Today’s Topics The Apache Web Server –Structure –Differentiators –Server Directories –Server Configuration –Server Control
20-753: Fundamentals of Web Programming 3 Lecture 11: Web Server Case Study Structure Web server runs as a background (“demon”) process called httpd Listens for connection requests on port 80 (usually) Implements the HTTP protocol For a typical enterprise, runs on a Unix server and is started automatically at system boot time
20-753: Fundamentals of Web Programming 4 Lecture 11: Web Server Case Study Differentiators Security features Flexibility in configuration Cost ($0!) Result: most commonly-used web server today Best bet for a reliable, inexpensive small-to-mid-size web site: a PC running Linux and Apache
20-753: Fundamentals of Web Programming 5 Lecture 11: Web Server Case Study Server Directories The document root –“top level” of the server –subdirectories match URL path –e.g. /home/httpd/html/PowerPoint Scripts directory –usually, /home/httpd/cgi-bin –config. option: scripts anywhere
20-753: Fundamentals of Web Programming 6 Lecture 11: Web Server Case Study Server Directories Log Directory –access_log: all the HTTP requests –error_log: requests which resulted in an error message to the user –Other: specialized logs for extra server modules; e.g., servlet_log
20-753: Fundamentals of Web Programming 7 Lecture 11: Web Server Case Study Server Configuration httpd.conf –File which controls all aspects of server configuration –Found in /etc/httpd/conf/ subdirectory mime.types –Determines what HTTP headers the server returns for different filename extensions; can be customized
20-753: Fundamentals of Web Programming 8 Lecture 11: Web Server Case Study Server Control Starting –apachectl start Stopping –apachectl stop Restarting –apachectl restart –useful when tweaking httpd.conf (tweak/restart, tweak/restart, … )
20-753: Fundamentals of Web Programming 9 Lecture 11: Web Server Case Study Putting It Together Detailed Walkthrough –Server Directories –Server Logs –Server Configuration Files –Server Control Commands