Notes from class, August 30, 2007

Mapping between domain names and web servers

1 domain name <--> n servers
--Load sharing
--Security (against Denial of Service attacks)

n domain names <--> 1 server
--Reduce costs (unrelated domains)
--Parked domains - aliases (related domains)

DNS--Domain Name Service

Name servers map domain name (e.g., to IP address (e.g.

HTTP--HyperText Transfer Protocol

--User types in URL or clicks on link
--Browser uses DNS to find IP address for server
--Browser sends request and header information

Sample request:
GET /index.html HTTP/1.1
--Server finds file.
--Server sends headers and file to browser.

CGI: Server starts another process, browser request goes to input of CGI process, output of CGI process goes to browser.

PHP: Usually installed as a module of the web server so the server does not have to make a new process and there is less overhead.
--Browser receives page and displays it.
--Browser must make additional requests for pictures and other embedded files.

You can see what the server sends back by connecting with telnet like this:
    telnet 80
When the connection is open, send a request:
    GET /index.html HTTP/1.0
You will need to press Enter twice.
Telnet will display something like this:
HTTP/1.1 200 OK
Date: Tue, 04 Sep 2007 18:17:42 GMT
Server: Apache/1.3.33 (Darwin) mod_ssl/2.8.24 OpenSSL/0.9.7l
Cache-Control: max-age=60
Expires: Tue, 04 Sep 2007 18:18:42 GMT
Last-Modified: Wed, 22 Aug 2007 14:33:54 GMT
ETag: "22a-84-46cc4952"
Accept-Ranges: bytes
Content-Length: 132
Connection: close
Content-Type: text/html


<img src="logo2_200.png">

Welcome to Universe<br/>

Connection closed by foreign host.
A tutorial written by two BYU CS students is available here.

One of the main changes made in HTTP 1.1 is that by default, the connection is left open so that the browser can request additional files (like pictures) without having to open a new connection.

Document root

The web server will only serve files from specified directory trees.
e.g., Apache on Linux: /var/www/html

User document directories
typical on Linux: ~user/public_html
typical on OS X: ~user/Sites

Our class server, Universe, runs OS X and you should put your files in your Sites directory.

URLs for user document directories:
In other words, public_html or Sites is not in the URL.


In order for the web server to serve a file, the file must have the permissions set to allow "others" to read the file. Unix-style operating systems (including OS X and Linux) use rwx bits to determine who can access a file. See the Unix tutorial (Tutorial Five) on the Notes page for more information.