Web browser and Web server

advertisement
Lecture 6. Web Browser and Web Server
Objective: to understand how a browser interacts with a
web server.
•
Web Browsers
A client software program that allows you to access
and view Web pages on the Internet
– Examples
• Mosaic, Netscape, Mozilla, Firefox (4.9%)
Opera, Safari (for Apple computer)
• Microsoft Internet Explorer (90%)|
•
How a browser work?
– Given a URL, a browser intimates a request to a
DNS server to resolve the IP address of the host
specified in URL.
CP476 Internet Computing Browser and Web Server
1
– Combining the IP address and the document path of
the URL, the browser initiates a request for the
document to a server, and the server responses to
the request.
• Most requests are for existing documents,
• Some requests are for program execution, with
the output being returned as a document
– A browser provides a graphic interface for a rich,
repository of rich text, hypertext, images, audio,
video, and other document types
– Basic components of a browser
• GUI
• Domain name resolution module
• Requesting module
• Response processing module
• A Web document parser module
• A document display engine.
CP476 Internet Computing Browser and Web Server
2
•
Case study: Mosaic
– Mosaic is the first graphical browser for the WWW
that supports hypermedia, developed by NCSA
which quickly gained popular and became the
industry standard.
– HTTP is the primary protocol used by Mosaic to
distribute documents from the HTTPD information
management services to Mosaic clients.
– Check the source code of Mosaic for detail
CP476 Internet Computing Browser and Web Server
3
•
Web Servers
– A computer that provides World Wide Web services
on the Internet. It includes hardware, operating
system, Web server software, TCP/IP software,
and Web pages and programs.
– Web server software is an application program that
serves Web pages to Web browsers using the
HTTP protocol.
– Provide responses to browser’s requests for either
existing documents or dynamically built documents
– Examples
• Apache (2/3)
• Internet Information Server (IIS) by Microsoft
CP476 Internet Computing Browser and Web Server
4
•
How does a Web server work?
– The primary task of a Web server is to monitor a
communication port on its host machine, accept
HTTP commands through that port, and perform
the operations specified by the commands.
– Example of HTTP commands: GET, PUT, POST,
HEAD, and DELET. All commands include a URL
– When a Web server starts, it tell its OS it is ready to
accept communications through a specific port,
usually 80
– When the URL is received, it is translated into
either a filename (in which case the file is returned
to the requesting client), or a program name (which
case the program is run and its output is sent to
requesting client)
CP476 Internet Computing Browser and Web Server
5
•
Contemporary servers provide many services
– Virtual hosts - multiple sites on the same system
– Proxy servers - to serve documents from the
document roots of other sites
– Besides HTTP, support for FTP, Gopher, News,
email
– Support for database access
CP476 Internet Computing Browser and Web Server
6
•
Case study: Apache
– Apache began with the NCSA server httpd.
Working with Mosaic.
– Apache is now an open source Web server
originally formed by taking all the "patches" (fixes)
to the NCSA Web server and making a new server
out of it, as a project organized by Apache
Software Foundation
•
Apache has a long list of services beyond the basic
process of serving documents to clients.
– Services can be configured
• There are three configuration files:
httpd.conf, srm.conf, and access.conf
• There are about 150 different directives can be
specified
– When Apache starts execution, it reads the three
configuration files and sets its parameters
accordingly
CP476 Internet Computing Browser and Web Server
7
•
The file structure of Apache
– Apache has two separate directories
• document root
• server root
– The document root is the root directory of all
servable documents
• Example
An Apache server runs on physcomp1
Name:
Domain name:
IP address:
Document root:
Server root:
– The server can have virtual document trees.
Sometimes a different disk, possibly on a
different machine, is used after the original disk
is filled
CP476 Internet Computing Browser and Web Server
8
– The server root is the root directory for all of the
code that implements the server
• The server root usually has four files:
One is the code for the server itself
Three others are subdirectories
conf - for configuration information
logs - to store what has happened
cgi-bin - for executable scripts
•
The configuration file is named httpd.conf
– The directives in the configuration file control the
operation of the server
– Configuration file format:
• Non-blank lines that do not begin with # must
begin with a directive name, which may take
parameters, separated by white space
• When Apache begins, it reads the configuration
files and sets its parameters according to what it
reads
CP476 Internet Computing Browser and Web Server
9
• ServerName - default is what is returned by
th hostname command, but it may be only
the first part
• ServerName www.bloomers.com
• ServerRoot - to set the server root address
– Default is /usr/local/etc/httpd
If it is stored elsewhere, tell Apache
with:
• ServerRoot: set the document root
• ServerAdmin
• DocumentRoot - set the document root
address
CP476 Internet Computing Browser and Web Server
10
• Alias - to specify a virtual document tree
– Takes two parameters, virtual path for URLs
and the actual path
– Example:
– Alias /test/ /usr/local/apache/test/
– http://physcomp1.wlu.ca/test/test.html
will be mapped to
/usr/local/apache/test/test.html
• ScriptAlias - creates a virtual directory
for cgi files
ScriptAlias /cgi-bin/ /usr/local/etc/httpd/cgi-bin/
• Redirect
• DirectoryIndex index.html contents.html index.cgi
• UserDir public_html
(UserDir disabled)
• Log file
– Tips for building your directory on phycomp1
CP476 Internet Computing Browser and Web Server
11
Download