Web Servers (IIS, PWS and Apache) : WW W .D e
Web Servers (IIS, PWS and Apache) : WW W .D e
Web Servers (IIS, PWS and Apache) : WW W .D e
and Apache)
21.1 Introduction
In this chapter, we discuss specialized softwarecalled a Web serverthat responds to cli- ent (e.g., Web browser) requests by
providing resources (e.g., XHTML documents). For example, when users enter a Uniform Resource Locator (URL) address, such as
www.de- itel.com, into a Web browser, they are requesting a specific document from a Web serv- er. The Web server maps
the URL to a file on the server (or to a file on the servers network) and returns the requested document to the client. During this
interaction, the Web server and the client communicate using the platform-independent HyperText Transfer Protocol (HTTP), a
protocol for transferring requests and files over the Internet (i.e., between Web servers and Web browsers).
Our Web-server discussion introduces Microsoft Internet Information Services (IIS),
Microsoft Personal Web Server (PWS) and the open source Apache Web Server. Sections
21.6, 21.7 and 21.8 discuss IIS, PWS and Apache, respectively. Figure 21.1 overviews these Web servers.
For illustration purposes, we use Internet Explorer to request various documents
XHTML, Active Server Pages (ASP), Perl, Python and PHP. We discuss the specifics of ASP (Chapter 25), Perl (Chapter 27),
Python (Chapter 28) and PHP (Chapter 29). This chapter concentrates on the steps for requesting documents from a Web server.
data in a relational database management system (RDBMS). We discuss RDBMS in further detail in Chapter 22, Database: SQL,
MySQL, DBI and ADO. For example, a retail store may have a database for product information, such as descriptions, prices and
quantities in stock. The same database also may contain customer information, such as user names, billing addresses and credit-card
numbers.
The middle tier implements business logic and presentation logic to control interac- tions between application clients and
application data. The middle tier acts as an interme- diary between data in the information tier and the application clients. The
middle-tier controller logic processes client requests from the top tier (e.g., a request to view a product catalog) and retrieves data
from the database. The middle-tier presentation logic then pro- cesses data from the information tier and presents the content to the
client.
Business logic in the middle tier enforces business rules and ensures that data are reliable before updating the database or presenting data to a user. Business rules dictate how clients can and cannot access application
data and how applications process data.
The middle tier also implements the applications presentation logic. Web applications typically present information to
clients as XHTML documents (older applications present information as HTML). XHTML is discussed in Chapter 4, Introduction to
XHTML: Part 1 and Chapter 5, Introduction to XHTML: Part 2. Many Web applications present information to wireless clients as Wireless Markup Language (WML) documents. We discuss
WML in further detail in Chapter 23, Wireless Internet and m-Business.
The client tier, or top tier, is the applications user interface. Users interact directly with the application through the user
interface. The client interacts with the middle tier to make requests and to retrieve data from the information tier. The client then
displays the data retrieved from the middle tier to the user.
Fig. 21.3
In the Internet Services Manager dialog, the left pane contains the Web servers direc- tory structure. The name of the machine
running IIS (e.g., carpenterant) is listed under Internet Information Services. Clicking the + symbol to the left of the
machine name displays Default FTP Site, Default Web Site and Default SMTP Virtual Server.
The Default FTP Site is a File Transfer Protocol (FTP) site; the Default Web Site is an HTTP site. Although FTP and
HTTP permit transferring documents between a com- puter and a Web server, FTP provides a faster and more persistent connection
between the client and the Web server than HTTP. HTTP is used most frequently to request documents from Web servers. The
Default SMTP Virtual Server allows for the creation of a Simple Mail Transfer Protocol (SMTP) server, which sends and
receives electronic mail (e-mail).
Expand the Default Web Site directory by clicking the + to the left of it. In this direc- tory we will create a virtual directory for
the HTTP Web site. The Default Web Site subdi- rectories are virtual directories. Most Web documents are placed in the Web
servers Webpub (Web publishing) directory. For this example, we create our virtual directory in the Webpub virtual directory. To
create a virtual directory within this directory, right-click Webpub, select New and then Virtual Directory. This starts the Virtual
Directory Cre- ation Wizard (Fig. 21.4), which guides users through the virtual directory creation process.
To begin, click Next in the Virtual Directory Creation Wizard welcome dialog. In
the Virtual Directory Alias dialog (Fig. 21.5), enter a name for the virtual directory and click Next. We use the name
Chapter21Test, although the virtual directory may have any name provided that the name does not conflict with an existing virtual
directory name.
In the Web Site Content Directory dialog (Fig. 21.6), enter the path for the directory containing the documents that clients will view. We created a directory named C:\Chapter21Examples that serves our
documents, although any existing directory would be appropriate. If necessary, select the Browse button to navigate to the desired
directory. Click Next.
Fig. 21.5
Fig. 21.6
The Access Permissions dialog (Fig. 21.7) presents the virtual directory security level choices. Choose the access level
appropriate for a Web document. The Read option allows users to read and download files located within the directory. The Run
scripts (such as ASP) option allows scripts to run in the directory. The Execute (such as ISAPI applications or CGI)
option allows applications to run in the directory. The Write option allows a Web page to accept user input (e.g., users enter their
credit-card number to order a book). The Browse option allows users to navigate from one Web document to another through
hyperlinks. By default, Read and Run scripts are enabled. Click Next.
Click Finish to complete the creation of the virtual directory and exit the Virtual
Directory Creation Wizard. The newly created virtual directory, Chapter21Test, is now located under the Webpub virtual
directory. To stop IIS, right click Default Web Site (or Default FTP Site or Default SMTP Virtual Server) and select Stop.
Fig. 21.7
Fig. 21.8
On the Main screen, double click the Advanced icon at the bottom of the left pane. In the screen that appears, click the Add
button. In the Directory field of the Edit Direc- tory dialog (Fig. 21.9), enter the directory path that contains the documents
available to cli- ents. We created a directory named C:\Chapter21Examples to serve our documents. You may choose any
existing directory. If necessary, select the Browse button to navigate to the directory. In the Alias field, provide the virtual
directory name (e.g., Chapter21Test). Next, select the security level of the virtual directory. The Read option allows users to
read and download files residing in the virtual directory. The Exe- cute option allows an application to run in the directory. The
Scripts option allows scripts to run in the directory. By default, Read and Scripts are enabled. When finished, click OK to
create the directory. To stop PWS, select the Stop button from the Personal Web Manager dialog.