Web Servers - Chitu's Home on the Web

bubblesradiographerΔιακομιστές

4 Δεκ 2013 (πριν από 3 χρόνια και 6 μήνες)

85 εμφανίσεις

1

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

2

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

3

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.

4

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)

5

21.1

Introduction


IIS 5.0

IIS 6.0

Apache Web server

Company

Microsoft

Corporation

Microsoft

Corporation

Apache Software

Foundation

Version

5.0

6.0

2.0.47

Released

2/17/00

3/28/03

7/10/03

Platforms

Windows 2000,
Windows XP

Windows
Server
2003

Windows NT/2000/XP,

Mac OS X, Linux and
other

UNIX
-
based
platforms
,
exper
imentally supports
Windows 95/98

Brief

description

The most popular
Web server for
Windows 2000.

The newest release of
IIS from Microsoft.

Currently the most

popular Web server.

Price

Included with

Windows 2000
and Windows
XP.

Included with
Windows
Server
20
03

Freeware.

Fig. 21.1

Web servers discussed in this chapter.


6

Web server architecture

7

How the WWW Works

(Fitzgerald and Dennis, 2005 Figure 2.8)

8

Domain
Name
Server
System

(Fitzgerald and Dennis, 2005 Figure 5.8)

9

Example of an HTTP Request
from a Web browser

GET http://www.kelley.indiana.edu/ardennis/home.htm HTTP/1.1

Date: Mon 06 Aug 2001 17:35:46 GMT

User
-
Agent: Mozilla/6.0

Referer: http://www.indiana.edu/~aisdept/faculty.htm

Request Header

]
-

Request


Line

]
-

Web browser (this is Netscape)

Command


URL



HTTP version

URL that contained the link to the requested URL

(Fitzgerald and Dennis, 2005 Figure 2
-
9)

10

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>

HTTP response from a Web server


HTTP version Status code Reason

Response
Header

Response

Body

(Fitzgerald and Dennis, 2005 Figure 2
-
10)

11

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

12

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

13

N
-
tier Client
-
Server Architecture

(Fitzgerald and Dennis, 2005 Figure 2.5)

14

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

15

Installing a web server

16

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/


17

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


18

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

19

21.7

Apache Web Server



Currently the most popular Web server


Stability


Efficiency


Portability


Open
-
source

20

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


21

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

22

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/

23

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.

24

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

25

References


Fitzgerald, Jerry and Alan Dennis, 2005.
Business Data Communications and
Networking
. 8
th

edition. Wiley: New York.