210 likes | 274 Views
21. Web Servers (IIS and Apache). 21.1 Introduction. A web server responds to client requests A web server and a client communicate using the platform-independent Hypertext Transfer Protocol (HTTP). 21.2 HTTP Transactions.
E N D
21 Web Servers(IIS and Apache)
21.1 Introduction • A web server responds to client requests • A web server and a client communicate using the platform-independent Hypertext Transfer Protocol (HTTP)
21.2 HTTP Transactions • The HTTP protocol allows clients and servers to interact and exchange information. • HTTP uses URLs (Uniform Resource Locators)to identify data on the Internet. http:// indicates that the resource is to be obtained using the HTTP protocol.
21.2 HTTP Transactions (Cont.) • A hostname is translated into an IP • Translation is performed by a domain name system (DNS) server • Virtual Directory: • For security reasons the path normally specifies the location of a virtual directory. • The server translates the virtual directory into a real location on the server.
21.2 HTTP Transactions (Cont.) • HTTP method get indicates that the client wishes to obtain a resource from the server. • HTTP status code 200 indicates success. Status code 404 informs the client that the web server could not locate the requested resource.
Fig. 21.1 | Client interacting with web server. Step 1: The GET request.
Fig. 21.2 | Client interacting with web server. Step 2: The HTTP response.
21.3 Multitier Application Architecture • Web-based applications are multitier applications that divide functionality into separate tiers. • The bottom tier maintains the application’s data. • The middle tier implements business logicto control interactions between the client and data. Business rules dictate how clients can and cannot access application data, and how applications process data. • The top tieris the application’s user interface. The client tier never directly interacts with the data tier.
21.4 Client-Side Scripting versus Server-Side Scripting • Client-side scripting can be used to validate user input, to interact with the browser • Client-side scripting does have limitations, such as browser dependency. • Sensitive information, such as passwords or other personally identifiable data, should not be stored or validated on the client. • Server-side scripting languages can access the server’s file directory structure.
Software Engineering Observation 21.2 Properly configured server-side script source code is not visible to the client; only XHTML and any client-side scripts are visible to the client.
21.5 Accessing Web Servers • Local web servers can be accessed through your computer’s name or through the name Localhost a hostname that references the local machine and normally translates to the IP address 127.0.0.1 (also known as the loopback address).
21.6 Microsoft Internet Information Services (IIS) • Microsoft Internet Information Services (IIS) is a web server. Installing IIS on a machine allows that computer to serve documents. • To install IIS 5.1 on Windows XP, you may need your original operating-system disk.
Fig. 21.4 | Internet Information Services window of IIS 5.1.
Fig. 21.9 | Internet Information (IIS) Services Manager window (IIS 7.0).
21.7 Apache HTTP Server • The Apache HTTP Serveris currently the most popular web server. • It is open source software that runs on UNIX, Linux, Mac OS X, Windows platforms.
Fig. 21.11 | Apache Service Monitor. (Courtesy of The Apache SoftwareFoundation, <http://www.apache.org/>.)
21.8 Requesting Documents • Static Web Pages • The server sends XHTML documents to the client as static web pages. • Dynamic Web Pages • For other types such as PHP, Ruby on Rails, ASP.NET and JavaServer Faces, the appropriate scripting engine first generates XHTML content, then transmits it to the client over HTTP.