HTML and CSS Reference
In-Depth Information
What Does a Web Server Do?
To publish web pages, you need a web server. The server listens for requests from web
browsers and returns the resources specified in the URL in those requests. Web servers
and web browsers communicate using the Hypertext Transfer Protocol (HTTP), a proto-
col created specifically for the request and transfer of hypertext documents over the Web.
Because of this use, web servers often are called HTTP servers .
Other Things Web Servers Do
Although the web server's primary purpose is to answer requests from browsers, it's
responsible for several other tasks. You'll learn about some of them in the following sec-
File and Media Type Determination
In Lesson 12, “Integrating Multimedia: Sound, Video, and More,” you learned about con-
tent types and how browsers and servers use file extensions to determine file types.
Servers are responsible for telling the browsers what kinds of content the files contain.
Web servers are configured so that they know which media types to assign to files that
are requested so that the browser can tell audio files from HTML pages from style
File Management
The web server also is responsible for rudimentary file management—mostly in deter-
mining how to translate URLs into the locations of files on the server. If a browser
requests a file that doesn't exist, the web server returns the HTTP error code 404 and
sends an error page to the browser. You can configure the web server to redirect from
one URL to another, automatically pointing the browser to a new location if resources
move or if you want to retire them. Servers can also be set up to return a particular file if
a URL refers to a directory on a server without specifying a filename.
Finally, servers keep log files for information on how many times each URL on the site
has been accessed, including the address of the computer that accessed it, the date and,
optionally, which browser they used, and the URL of the page that referred them to your
page. Web servers also keep a log of any errors that occur when browsers submit
requests so that you can track them down and fix them.
Server-Side Scripts and Forms Processing
In addition to serving up static documents such as HTML files and images, most web
servers offer the option of running scripts or programs that generate documents on-the-
fly. These scripts can be used to create catalogs and shopping carts, discussion boards,
clients to read email, or content management systems to publish documents dynamically.
Search WWH ::

Custom Search