1
Chapter 21 – Web Servers
(IIS and Apache)
Outline
21.1 Introduction
21.2 HTTP Request Types
21.3 System Architecture
21.4 Client-Side Scripting versus Server-Side Scripting
21.5 Accessing Web Servers
21.6 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
21.7 Apache Web Server
21.8 Requesting Documents
21.8.1 XHTML
21.8.2 ASP.NET
21.8.3 Perl
21.8.4 PHP
21.8.5 Python
21.9 Web Resources
2
Objectives
In this lesson, you will learn:
To understand a Web server’s functionality.
To introduce Apache Web server.
To learn how to request documents from a Web server.
3
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)
4
21.1 Introduction
IIS 5.0 IIS 6.0 Apache Web server
Company Microsoft Microsoft Apache Software
Corporation Corporation Foundation
Version 5.0 6.0 2.0.47
Released 2/17/00 3/28/03 7/10/03
Platforms Windows 2000, Windows Server 2003 Windows NT/2000/XP,
Windows 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
6
How the WWW Works
7
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
Date: Mon 06 Aug 2001 17:35:46 GMT Line
User-Agent: Mozilla/6.0 ]- Web browser (this is Netscape)
Referer: http://www.indiana.edu/~aisdept/faculty.htm Request Header
URL that contained the link to the requested URL
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 Response
Header
Location: http:// www.kelley.indiana.edu/adennis/home.htm ]- URL
Content-type: text/html ]- Type of file
Jonathan Web Server
Response
Jonathan Body
Welcome to the Home Page of Jonathan Dela Cruz
(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 URL—visible 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 request—invisible 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)
Application’s 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
15
Hosting a website:
Self hosting
Install a web server on a computer
Local access
Using domain
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 popular—fully 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 and folders into
the 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
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 document’s 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.as
p
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