2000 deitel & associates, inc. all rights reserved. chapter 24 – web servers (pws, iis,...

27
2000 Deitel & Associates, Inc. All rights reserved. 2000 Deitel & Associates, Inc. All rights reserved. Chapter 24 – Web Servers (PWS, IIS, Apache, Jigsaw) Outline 24.1 Introduction 24.2 Microsoft Personal Web Server Overview 24.3 Microsoft Personal Web Server Setup 24.4 Getting Started with Microsoft Personal Web Server 24.5 Microsoft Internet Information Server (IIS) 24.6 Apache Web Server 24.7 W3C Jigsaw Web Server 24.8 Web Server Error Codes

Upload: samantha-haynes

Post on 25-Dec-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 2000 Deitel & Associates, Inc. All rights reserved. Chapter 24 – Web Servers (PWS, IIS, Apache, Jigsaw) Outline 24.1Introduction 24.2Microsoft Personal

2000 Deitel & Associates, Inc. All rights reserved. 2000 Deitel & Associates, Inc. All rights reserved.

Chapter 24 – Web Servers (PWS, IIS, Apache, Jigsaw)

Outline24.1 Introduction24.2 Microsoft Personal Web Server Overview24.3 Microsoft Personal Web Server Setup24.4 Getting Started with Microsoft Personal

Web Server24.5 Microsoft Internet Information Server

(IIS)24.6 Apache Web Server24.7 W3C Jigsaw Web Server24.8 Web Server Error Codes

Page 2: 2000 Deitel & Associates, Inc. All rights reserved. Chapter 24 – Web Servers (PWS, IIS, Apache, Jigsaw) Outline 24.1Introduction 24.2Microsoft Personal

2000 Deitel & Associates, Inc. All rights reserved. 2000 Deitel & Associates, Inc. All rights reserved.

24.1 Introduction• Network

– Allows two or more computers to communicate and share resources

– Any network requires servers• Manage access to files, folders, hardware and software

• Web server– Network server that manages access to files, folders and

other resources over Internet or local Intranet via HTTP • HTTP: HyperText Transfer Protocol

– Client-server protocol (like FTP)

– Handle permissions– Execute programs– Keep track of directories and files– Communicate with client computers

Page 3: 2000 Deitel & Associates, Inc. All rights reserved. Chapter 24 – Web Servers (PWS, IIS, Apache, Jigsaw) Outline 24.1Introduction 24.2Microsoft Personal

2000 Deitel & Associates, Inc. All rights reserved. 2000 Deitel & Associates, Inc. All rights reserved.

A Web server communicating with several HTTP clients

Page 4: 2000 Deitel & Associates, Inc. All rights reserved. Chapter 24 – Web Servers (PWS, IIS, Apache, Jigsaw) Outline 24.1Introduction 24.2Microsoft Personal

2000 Deitel & Associates, Inc. All rights reserved. 2000 Deitel & Associates, Inc. All rights reserved.

Web servers discussed in this chapter

Web Server PWS IIS Apache Jigsaw

Version 4.0 4.0 1.3.9 2.0.3

Company Microsoft Corporation

Microsoft Corporation

Apache Group World Wide Web Consortium

Released 12/4/97 12/4/97 8/20/99 8/17/99

Platforms Windows 95/98, Windows NT

Windows NT Server (Intel/Alpha)

UNIX, Windows NT, experimentally supports Windows 95/98.

Windows NT, Windows 95/98, UNIX (Solaris 2.x).

Brief description

Supports up to 10 concurrent connections; no longer supports FTP.

Latest release of the most popular Web server for Windows NT.

The most popular Web server currently in use on the Internet.

Java-based server that provides a blueprint for future Web development.

Features A great entry-level Web server for publishing your own Web pages.

Updated versions of IIS, Index Server, Message Queue Server (MSMQ) and Transaction Server (MTS).

High performance, extremely reliable Web server.

Administration tools; completely object-oriented design; written entirely in Java.

Price Freeware. Packaged with Microsoft IIS in NT 4.0 Option Pack, also included in Windows 98.

Free download (requires IE 4.01 or later). A CD-ROM version can be purchased.

Freeware. Freely available under open-source license.

Page 5: 2000 Deitel & Associates, Inc. All rights reserved. Chapter 24 – Web Servers (PWS, IIS, Apache, Jigsaw) Outline 24.1Introduction 24.2Microsoft Personal

2000 Deitel & Associates, Inc. All rights reserved. 2000 Deitel & Associates, Inc. All rights reserved.

24.2 Microsoft Personal Web Server Overview

• Microsoft Personal Web Server (PWS)– Use Internet Database Connector (IDBC), CGI and

ASP– Capabilities:

1. Webs published as whole with single command2. Publish Web sites from local computer to remote computer,

from remote computer to local computer, or between remote Web sites

3. CGI, IDC, ASP and Microsoft Internet Server Application Programming Interface (ISAPI) programs and FrontPage WebBots

4. “smart” web management– Publish “changed pages only” option

5. Sets permissions and properties of webs and folders6. Sets up virtual directories on server7. Browse webs from another computer when you are logged on

Page 6: 2000 Deitel & Associates, Inc. All rights reserved. Chapter 24 – Web Servers (PWS, IIS, Apache, Jigsaw) Outline 24.1Introduction 24.2Microsoft Personal

2000 Deitel & Associates, Inc. All rights reserved. 2000 Deitel & Associates, Inc. All rights reserved.

24.3 Microsoft Personal Web Server Setup

1. Verify presence of Microsoft TCP/IP Protocol

2. Install PWS Software

Page 7: 2000 Deitel & Associates, Inc. All rights reserved. Chapter 24 – Web Servers (PWS, IIS, Apache, Jigsaw) Outline 24.1Introduction 24.2Microsoft Personal

2000 Deitel & Associates, Inc. All rights reserved. 2000 Deitel & Associates, Inc. All rights reserved.

24.4 Getting Started with Microsoft Personal Web Server

1. Start Personal Web Server

2. Test for Successful Installation of PWS• Loopback address

• Virtual address allows testing of computer’s TCP/IP stack from same computer

• http://127.0.0.1

Default Web site page for PWS

Page 8: 2000 Deitel & Associates, Inc. All rights reserved. Chapter 24 – Web Servers (PWS, IIS, Apache, Jigsaw) Outline 24.1Introduction 24.2Microsoft Personal

2000 Deitel & Associates, Inc. All rights reserved. 2000 Deitel & Associates, Inc. All rights reserved.

24.4 Getting Started with Microsoft Personal Web Server (II)

3. Create a Web Site on Your Own Computer– Create root web

• Root web: web that is top-level content directory of Web server• By default, home directory is C:\Webshare\Wwwroot

4. Access PWS from Other Computers– Address is http:// followed by IP address of server

5. Publish Information and Applications– Server can contain anything from static pages to interactive

applications– Interact with databases

6. Prepare Information for Publishing– HTML

Page 9: 2000 Deitel & Associates, Inc. All rights reserved. Chapter 24 – Web Servers (PWS, IIS, Apache, Jigsaw) Outline 24.1Introduction 24.2Microsoft Personal

2000 Deitel & Associates, Inc. All rights reserved. 2000 Deitel & Associates, Inc. All rights reserved.

24.4 Getting Started with Microsoft Personal Web Server (III)

7. Publish Dynamic Applications– Run applications or scripts

• Remote users start by clicking HTML links or forms

• Perl, C

• CGI (Common Gateway Interface)

• ISAPI

– Dynamic Link Libraries (DLLs)

– Require less overhead than CGI scripts

– Microsoft-specific technology

– Place scripts in /Scripts directory

– Adjust permissions

Page 10: 2000 Deitel & Associates, Inc. All rights reserved. Chapter 24 – Web Servers (PWS, IIS, Apache, Jigsaw) Outline 24.1Introduction 24.2Microsoft Personal

2000 Deitel & Associates, Inc. All rights reserved. 2000 Deitel & Associates, Inc. All rights reserved.

24.4 Getting Started with Microsoft Personal Web Server (IV)

• PWS extension interpreters (Windows 95/98)

• Personal Web Manager dialog

File Extension Default Interpreter

.exe, .com, .bat, .cmd Cmd.exe

.idc Httpodbc.dll

.asp, .asa Asp.dll

Page 11: 2000 Deitel & Associates, Inc. All rights reserved. Chapter 24 – Web Servers (PWS, IIS, Apache, Jigsaw) Outline 24.1Introduction 24.2Microsoft Personal

2000 Deitel & Associates, Inc. All rights reserved. 2000 Deitel & Associates, Inc. All rights reserved.

24.4 Getting Started with Microsoft Personal Web Server (V)

8. Publish information and use a database– Open Data Base Connectivity (ODBC) drivers

• Allow inserts, updates and deletes of info in database

– Structured Query Language (SQL) commands

– Internet Database Connector (IDC) component of PWS, Httpodbc.dll

• Internet Database Connector (.idc) files

• HTML extension (.htx) files

– Template for actual HTML document returned to browser after database info merged by Httpodbc.dll

Page 12: 2000 Deitel & Associates, Inc. All rights reserved. Chapter 24 – Web Servers (PWS, IIS, Apache, Jigsaw) Outline 24.1Introduction 24.2Microsoft Personal

2000 Deitel & Associates, Inc. All rights reserved. 2000 Deitel & Associates, Inc. All rights reserved.

24.4 Getting Started with Microsoft Personal Web Server (V)

8. Publish information and use a database– Create system DSN (Data Source Name)– http://127.0.0.1/customers.idc?

• Question mark tells server request can take parameters

Page 13: 2000 Deitel & Associates, Inc. All rights reserved. Chapter 24 – Web Servers (PWS, IIS, Apache, Jigsaw) Outline 24.1Introduction 24.2Microsoft Personal

2000 Deitel & Associates, Inc. All rights reserved. 2000 Deitel & Associates, Inc. All rights reserved.

Outline

customers.idc file

1 Datasource:NWIND

2 Template:Customers.htx

3 SQLStatement:SELECT * FROM [Customers]

4 Password:

5 Username:

Page 14: 2000 Deitel & Associates, Inc. All rights reserved. Chapter 24 – Web Servers (PWS, IIS, Apache, Jigsaw) Outline 24.1Introduction 24.2Microsoft Personal

2000 Deitel & Associates, Inc. All rights reserved. 2000 Deitel & Associates, Inc. All rights reserved.

Outline

1. Create HTML template for actual document that will be returned to browser

1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

2<HTML>

3<HEAD>

4<META HTTP-EQUIV = "Content-Type"

5CONTENT = "text/html; charset = windows-1252">

6<TITLE>Customers</TITLE>

7</HEAD>

8<BODY>

9<TABLE BORDER = 1 BGCOLOR = #ffffff CELLSPACING = 0 RULES = none>

10<FONT FACE = "MS Sans Serif" COLOR = #000000><CAPTION>

11<B>Customers</B></CAPTION>

12

13<THEAD>

14<TR>

15<TH BGCOLOR = #c0c0c0 BORDERCOLOR = #000000><FONT SIZE = 2

16FACE = "MS Sans Serif" COLOR = #000000>CustomerID</FONT></TH>

17<TH BGCOLOR = #c0c0c0 BORDERCOLOR = #000000><FONT SIZE = 2

18FACE = "MS Sans Serif" COLOR = #000000>CompanyName</FONT></TH>

19<TH BGCOLOR = #c0c0c0 BORDERCOLOR = #000000><FONT SIZE = 2

20FACE = "MS Sans Serif" COLOR = #000000>ContactName</FONT></TH>

21<TH BGCOLOR = #c0c0c0 BORDERCOLOR = #000000><FONT SIZE = 2

22FACE = "MS Sans Serif" COLOR = #000000>ContactTitle</FONT></TH>

23<TH BGCOLOR = #c0c0c0 BORDERCOLOR = #000000><FONT SIZE = 2

24FACE = "MS Sans Serif" COLOR = #000000>Address</FONT></TH>

25<TH BGCOLOR = #c0c0c0 BORDERCOLOR = #000000><FONT SIZE = 2

26FACE = "MS Sans Serif" COLOR = #000000>City</FONT></TH>

27<TH BGCOLOR = #c0c0c0 BORDERCOLOR = #000000><FONT SIZE = 2

28FACE = "MS Sans Serif" COLOR = #000000>Region</FONT></TH>

29<TH BGCOLOR = #c0c0c0 BORDERCOLOR = #000000><FONT SIZE = 2

30FACE = "MS Sans Serif" COLOR = #000000>PostalCode</FONT></TH>

31<TH BGCOLOR = #c0c0c0 BORDERCOLOR = #000000><FONT SIZE = 2

Page 15: 2000 Deitel & Associates, Inc. All rights reserved. Chapter 24 – Web Servers (PWS, IIS, Apache, Jigsaw) Outline 24.1Introduction 24.2Microsoft Personal

2000 Deitel & Associates, Inc. All rights reserved. 2000 Deitel & Associates, Inc. All rights reserved.

Outline

Notice placeholders for database fields

32FACE = "MS Sans Serif" COLOR = #000000>Country</FONT></TH>

33<TH BGCOLOR = #c0c0c0 BORDERCOLOR = #000000><FONT SIZE = 2

34FACE = "MS Sans Serif" COLOR = #000000>Phone</FONT></TH>

35<TH BGCOLOR = #c0c0c0 BORDERCOLOR = #000000><FONT SIZE = 2

36FACE = "MS Sans Serif" COLOR = #000000>Fax</FONT></TH>

37

38</TR>

39</THEAD>

40<TBODY>

41<%BeginDetail%>

42<TR VALIGN = TOP>

43<TD BORDERCOLOR = #808080><FONT SIZE = 1 FACE = "MS Sans Serif"

44COLOR = #800000><%CustomerID%><BR></FONT></TD>

45<TD BORDERCOLOR = #808080><FONT SIZE = 1

46FACE = "MS Sans Serif" COLOR = #800000><%CompanyName%><BR>

47</FONT></TD>

48<TD BORDERCOLOR = #808080><FONT SIZE = 1

49FACE = "MS Sans Serif" COLOR = #800000><%ContactName%><BR>

50</FONT></TD>

51<TD BORDERCOLOR = #808080><FONT SIZE = 1

52FACE = "MS Sans Serif"

53COLOR = #800000><%ContactTitle%><BR></FONT></TD>

54<TD BORDERCOLOR = #808080><FONT SIZE = 1

55FACE = "MS Sans Serif" COLOR = #800000><%Address%><BR>

56</FONT></TD>

57<TD BORDERCOLOR = #808080><FONT SIZE = 1

58FACE = "MS Sans Serif" COLOR = #800000><%City%><BR>

59</FONT></TD>

60<TD BORDERCOLOR = #808080><FONT SIZE = 1

61FACE = "MS Sans Serif" COLOR = #800000><%Region%><BR>

62</FONT></TD>

Page 16: 2000 Deitel & Associates, Inc. All rights reserved. Chapter 24 – Web Servers (PWS, IIS, Apache, Jigsaw) Outline 24.1Introduction 24.2Microsoft Personal

2000 Deitel & Associates, Inc. All rights reserved. 2000 Deitel & Associates, Inc. All rights reserved.

Outline63<TD BORDERCOLOR = #808080><FONT SIZE = 1

64FACE = "MS Sans Serif" COLOR = #800000><%PostalCode%><BR>

65</FONT></TD>

66<TD BORDERCOLOR = #808080><FONT SIZE = 1

67FACE = "MS Sans Serif" COLOR = #800000><%Country%><BR>

68</FONT></TD>

69<TD BORDERCOLOR = #808080><FONT SIZE = 1

70FACE = "MS Sans Serif" COLOR = #800000><%Phone%><BR>

71</FONT></TD>

72<TD BORDERCOLOR = #808080><FONT SIZE = 1

73FACE = "MS Sans Serif" COLOR = #800000><%Fax%><BR>

74</FONT></TD>

75

76</TR>

77<%EndDetail%>

78</TBODY>

79<TFOOT></TFOOT>

80</TABLE>

81</BODY>

82</HTML>

Page 17: 2000 Deitel & Associates, Inc. All rights reserved. Chapter 24 – Web Servers (PWS, IIS, Apache, Jigsaw) Outline 24.1Introduction 24.2Microsoft Personal

2000 Deitel & Associates, Inc. All rights reserved. 2000 Deitel & Associates, Inc. All rights reserved.

customers.idc as requested and displayed in a Web browser

Page 18: 2000 Deitel & Associates, Inc. All rights reserved. Chapter 24 – Web Servers (PWS, IIS, Apache, Jigsaw) Outline 24.1Introduction 24.2Microsoft Personal

2000 Deitel & Associates, Inc. All rights reserved. 2000 Deitel & Associates, Inc. All rights reserved.

24.5 Microsoft Internet Information Server (IIS)

• Internet Information Server (IIS) – Extends Windows NT server to Intranets and Internet

– Provides full Intranet and Internet Web capabilities

– Publish information

– Access to data stored in various client/server databases

– Supports CGI

• CGI creates separate process for every request

• Microsoft alternative: ISAPI

– Back-end database access and programming

• IDC connects to back-end ODBC databases

– Insert, update, delete, etc.

• Internet Service Manager– GUI manager

Page 19: 2000 Deitel & Associates, Inc. All rights reserved. Chapter 24 – Web Servers (PWS, IIS, Apache, Jigsaw) Outline 24.1Introduction 24.2Microsoft Personal

2000 Deitel & Associates, Inc. All rights reserved. 2000 Deitel & Associates, Inc. All rights reserved.

24.6 Apache Web Server

• Apache– Leading UNIX Web server– High-performance httpd (HTTP daemon) server

• Daemon: UNIX background process that implements server side of a protocol

– Server-side programming tools and languages:• Perl• PHP3

– Scripting language that allows embedding scripting code into HTML pages

• Tcl• Python

– Access to Java Servlet API– JSP (JavaServer Pages)

• Embed java code within HTML templates dynamic pages processed entirely by server

Page 20: 2000 Deitel & Associates, Inc. All rights reserved. Chapter 24 – Web Servers (PWS, IIS, Apache, Jigsaw) Outline 24.1Introduction 24.2Microsoft Personal

2000 Deitel & Associates, Inc. All rights reserved. 2000 Deitel & Associates, Inc. All rights reserved.

24.6 Apache Web Server (II)

– Modules provide additional functionality• http://modules.apache.org/• mod_SSL

– Strong cryptography for Apache 1.3 Web server via Secure Sockets Layer

• mod_perl– Modules can be written entirely in Perl

• Jserv– Module that implements Sun’s Java Servlet API

– On Windows NT• Apache Web server run as console application or service

– Console application: stopping and starting server is manual

– Service: Apache starts whenever operating system starts

Page 21: 2000 Deitel & Associates, Inc. All rights reserved. Chapter 24 – Web Servers (PWS, IIS, Apache, Jigsaw) Outline 24.1Introduction 24.2Microsoft Personal

2000 Deitel & Associates, Inc. All rights reserved. 2000 Deitel & Associates, Inc. All rights reserved.

24.6 Apache Web Server (III)

• Starting the Apache Web Server as a console application

• Default Web site for Apache Web Server

Page 22: 2000 Deitel & Associates, Inc. All rights reserved. Chapter 24 – Web Servers (PWS, IIS, Apache, Jigsaw) Outline 24.1Introduction 24.2Microsoft Personal

2000 Deitel & Associates, Inc. All rights reserved. 2000 Deitel & Associates, Inc. All rights reserved.

24.7 W3C Jigsaw Web Server• W3C Jigsaw

– Free Web server written entirely in Java– Runs on most machines that support Java

• Microsoft Windows 95/98/NT • Sun Microsystems’ Solaris• Linux

– Object-oriented Web server– Major components:

• Daemon module– Deals with HTTP– Handles incoming connections– Creates new client objects– Decodes requests– Sends replies

• Resource module– Manages information space of server

Page 23: 2000 Deitel & Associates, Inc. All rights reserved. Chapter 24 – Web Servers (PWS, IIS, Apache, Jigsaw) Outline 24.1Introduction 24.2Microsoft Personal

2000 Deitel & Associates, Inc. All rights reserved. 2000 Deitel & Associates, Inc. All rights reserved.

Jigsaw batch installation process

Page 24: 2000 Deitel & Associates, Inc. All rights reserved. Chapter 24 – Web Servers (PWS, IIS, Apache, Jigsaw) Outline 24.1Introduction 24.2Microsoft Personal

2000 Deitel & Associates, Inc. All rights reserved. 2000 Deitel & Associates, Inc. All rights reserved.

Default Web site page for the Jigsaw Web server

Page 25: 2000 Deitel & Associates, Inc. All rights reserved. Chapter 24 – Web Servers (PWS, IIS, Apache, Jigsaw) Outline 24.1Introduction 24.2Microsoft Personal

2000 Deitel & Associates, Inc. All rights reserved. 2000 Deitel & Associates, Inc. All rights reserved.

JigAdmin authorization dialog and general properties page

Page 26: 2000 Deitel & Associates, Inc. All rights reserved. Chapter 24 – Web Servers (PWS, IIS, Apache, Jigsaw) Outline 24.1Introduction 24.2Microsoft Personal

2000 Deitel & Associates, Inc. All rights reserved. 2000 Deitel & Associates, Inc. All rights reserved.

JigAdmin Web configuration page

Page 27: 2000 Deitel & Associates, Inc. All rights reserved. Chapter 24 – Web Servers (PWS, IIS, Apache, Jigsaw) Outline 24.1Introduction 24.2Microsoft Personal

2000 Deitel & Associates, Inc. All rights reserved. 2000 Deitel & Associates, Inc. All rights reserved.

24.8 Web Server Error Codes

• W3C’s HTTP specification– Identifies specific errors that can be returned in Web server’s

response to HTTP requests

– All HTTP-compliant Web servers support these as well as HTTP status codes

– Common numeric error status codes:Error Code Description

Bad Request 400 Error in request syntax.

Unauthorized 401 Request requires an Authorization: field, and the client did not provide one. This response is accompanied by a list of acceptable authorization schemes use WWW-Authenticate response headers. Error 401 can be part of a client/server dialogue to negotiate encryption and user-authentication schemes.

Payment Required 402 The requested operation costs money, and the client did not specify a valid ChargeTo field.

Forbidden 403 Request for forbidden resource denied.

Not found 404 Requested resource not found.

Internal Error 500 The server has encountered an internal error and cannot continue processing the request.

Not implemented 501 Request acceptable but denied because server does not support this transaction method.