Web Servers
November 15, 2005
Slides modified from Internet & World Wide Web: How to Program. 2004 (3rd) edition. By Deitel, Deitel, and Goldberg. Published by Prentice Hall. ISBN 0-13-145091-3
Chapter 21 Web Servers (IIS and Apache)
Outline 21.1 21.2 21.3 21.4 21.5 21.6 Introduction HTTP Request Types System Architecture Client-Side Scripting versus Server-Side Scripting Accessing Web Servers Microsoft Internet Information Services (IIS) 21.6.1 Microsoft Internet Information Services (IIS) 5.0 21.6.2 Microsoft Internet Information Services (IIS) 6.0 Apache Web Server Requesting Documents 21.8.1 XHTML 21.8.2 ASP.NET 21.8.3 Perl 21.8.4 PHP 21.8.5 Python Web Resources
2
21.7 21.8
21.9
Objectives
In this lesson, you will learn:
To understand a Web servers functionality. To introduce Apache Web server. To learn how to request documents from a Web server.
21.1 Introduction
Web server
Responds to client requests by providing resources
URI (Uniform Resource Identifier) Web server and client communicate with platform-independent Hypertext Transfer Protocol (HTTP)
21.1 Introduction
Apache Web server Company Apache Software Foundation Version 2.0.47 Released 7/10/03 Platforms Windows NT/2000/XP, Mac OS X, Linux and other UNIX-based platforms, experimentally supports Windows 95/98 Brief The most popular The newest release of Currently the most description Web server for IIS from Microsoft. popular Web server. Windows 2000. Price Included with Included with Freeware. Windows 2000 Windows Server 2003 and Windows XP. Fig. 21.1 Web servers discussed in this chapter.
5
IIS 5.0 Microsoft Corporation 5.0 2/17/00 Windows 2000, Windows XP
IIS 6.0 Microsoft Corporation 6.0 3/28/03 Windows Server 2003
Web server architecture
How the WWW Works
(Fitzgerald and Dennis, 2005 Figure 2.8)
Domain Name Server System
(Fitzgerald and Dennis, 2005 Figure 5.8)
8
Example of an HTTP Request from a Web browser
Command URL HTTP version
GET http://www.kelley.indiana.edu/ardennis/home.htm HTTP/1.1 ]- Request Line Date: Mon 06 Aug 2001 17:35:46 GMT User-Agent: Mozilla/6.0 ]- Web browser (this is Netscape) Request Header Referer: http://www.indiana.edu/~aisdept/faculty.htm
URL that contained the link to the requested URL
(Fitzgerald and Dennis, 2005 Figure 2-9)
HTTP response from a Web server
HTTP version Status code Reason
HTTP/1.1 200 OK ]- Response Status Date: Mon 06 Aug 2001 17:35:46 GMT ]- Date Server: NCSA/1.3 ]- Web server Location: http:// www.kelley.indiana.edu/adennis/home.htm ]- URL Content-type: text/html ]- Type of file <html> <head> <title>Allen R. Dennis</title> </head> <body> <H2> Allen R. Dennis </H2> <P>Welcome to the home page of Allen R. Dennis</P>
</body> </html>
Response Header
Response Body
(Fitzgerald and Dennis, 2005 Figure 2-10)
10
21.2 HTTP Request Types
GET (default) and POST do basically the same thing: Send data from the client to the server. However, they have some differences: GET
Appends form data directly to the end of the URLvisible to users (not suitable for sending passwords) Limited to 2,048 characters for the entire URL Result page can be bookmarked and cached
POST
Sends form data in the HTTP requestinvisible to users Virtually no limit (but check your specific configuration) Results are not cacheable or bookmarkable
11
21.3 System Architecture
Multi-tier application (n-tier application)
Information tier (data or bottom tier)
Maintains data for the application Stores data in a relational database management system (RDBMS)
Middle tier
Implements business logic and presentation logic Control interactions between application clients and application data
Client tier (top tier)
Applications user interface Users interact directly with the application through the client tier
12
N-tier Client-Server Architecture
(Fitzgerald and Dennis, 2005 Figure 2.5)
13
21.4 Client-Side Scripting versus Server-Side Scripting
Client-side scripts
Validate user input
Reduce requests needed to be passed to server Access browser Enhance Web pages with DHTML, ActiveX controls, and applets
Server-side scripts
Executed on server Generate custom response for clients Wide range of programmatic capabilities Access to server-side software that extends server functionality
14
Installing a web server
15
Hosting a website: Self hosting
Install a web server on a computer Local access
Using domain <localhost> or IP address 127.0.0.1 Necessary for server-side programming development
Global access
Register a human-readable domain name Obtain IP address
Static: Costs more Dynamic: Needs dynamic DNS system, e.g. http://www.dyndns.com/
16
Hosting a website: Hosting service
Register a domain name
Assign name servers Host takes care of IP addressing
Develop website locally Upload website via FTP for global access
E.g. Filezilla
17
Web server architecture
LAMP: Most popularfully open source
Linux for operating system Apache for web server MySQL for database PHP for server-side scripting
Others:
WAMP: Uses Windows for operating system, with Apache, MySQL, and PHP WISA: Full Microsoft package
Windows Internet Information Server (IIS) SQL Server (enterprise) or Access (small-scale) ASP or ASP.NET
18
21.7 Apache Web Server
Currently the most popular Web server Stability Efficiency Portability Open-source
19
All-in-one Apache/MySQL/PHP packages
EasyPHP (recommended)
Includes PHPMyAdmin for administering MySQL database Installation and configuration
AbriaSoft Merlin Desktop Edition
Includes PHPMyAdmin
WAMP Server PHP Triad
20
Installing EasyPHP
Download EasyPHP, and follow the installation instructions In addition, move the <mysql> and <phpmyadmin> folders into the <www> folder in the EasyPHP installation folder For Windows 95, make the following adjustments before starting EasyPHP:
Download the Windows NT patch, rename it to EasyPHP.exe, and replace the existing EasyPHP.exe Open DOS prompt, go to the EasyPHP installation folder, and run <easyphp /install>
Run EasyPHP in Windows, and it will start Apache and MySQL (PHP and PHPMyAdmin do not need to start)
Note that Windows 95 might show that Apache is not working, though actually it is working
21
Requesting XHTML or PHP documents
Request PHP documents from Apache Save PHP documents in the www folder for EasyPHP (htdocs is the default Apache folder name) Launch web browser
With EasyPHP, right-click on the status bar icon and click Local Web
Enter PHP documents location in Address field, starting with http://localhost/ or http://127.0.0.1/
22
21.8.1 XHTML and PHP
Fig. 21.15
Requesting test.html from IIS 6 or Apache.
Fig. 21.23
Requesting test.php from Apache.
23
21.9 Web Resources
www.microsoft.com/msdownload/ntoptionpack/askwiz.a sp www.w3.org/Protocols www.apache.org httpd.apache.org httpd.apache.org/docs-2.0 www.apacheweek.com linuxtoday.com/stories/18780.html www.iisanswers.com www.iisadministrator.com
24
References
Fitzgerald, Jerry and Alan Dennis, 2005. Business Data Communications and Networking. 8th edition. Wiley: New York.
25