Web Server Basics  
            Even if you focus primarily on  what’s commonly referred to as “front-end” web development—HTML documents and  web graphics—the server and the way it is configured may impact the way you  work. In most cases, there is no way to avoid making first-hand contact with  the server, even if it’s just to upload files. 
            For this reason, all web  designers should have a basic level of familiarity with servers and what they  do. At the very least, this will enable you to communicate more clearly with  your server administrator. If you have permission for greater access to the  server, it could mean taking care of certain tasks yourself without needing to  wait for assistance. 
            Servers 101 
            A server is any computer  running software that enables it to answer requests for documents and other  data. The programs that request and display the documents (such as a browser)  are called clients. The terms “server-side” and “client-side,” in regard  to specific functions like imagemaps, refer to which machine is doing the processing.  Client-side functions happen on the user’s machine; server-side functions occur  on the remote machine. 
            Web servers answer requests from  browsers (the client program), retrieve the specified file (or execute a CGI  script) and return the document or script results. Web browsers and servers  communicate via the Hypertext Transfer Protocol (HTTP). 
            Popular Server Software 
            As of this writing, the majority  of web servers are running on the Unix platform. This is why a lot of Unix  terminology is still used in the web world. You may even need to learn a few  Unix commands in the course of a job. However, the percentage of Windows NT,  Windows 95, and even Macintosh servers is steadily increasing. Some server  packages offer a graphical interface as an alternative to Unix command-line  controls. 
            Some popular servers include: 
            NCSA Server 
              This is publicly  available server software maintained by the National   Center for Supercomputing  Applications at the University of Illinois  at Urbana-Champaign. It runs on the Unix platform. 
            Apache 
              A variation of  NCSA, Apache has become the most popular web server due to the fact that it is  a powerful server and it is available for free. It runs primarily on Unix, but  is being released to run on other platforms, including Windows NT. 
            CERN 
              This server,  maintained by the World Wide Web Consortium, is publicly available from http://www.w3.org.  It is also Unix-based. Netscape Servers Netscape provides a variety of  commercial server packages that run on Unix and NT platforms. 
            Internet Information Server (IIS) 
              This is  Microsoft’s server package. It is freely available, easy to install and configure,  and runs on Windows NT and 95 platforms.  
            The majority of servers today  (approximately 70%) run Apache or its predecessor, NCSA. The particular brand  of server does not impact the majority of things the designer does, such as  making graphics or developing basic HTML files. It will certainly influence  more advanced web site building techniques such as Server Side Includes, adding  MIME types (discussed later in this chapter), and database-driven web pages. Be  certain to coordinate with your server administrator if you are using your  server in ways beyond simple HTML and graphic files storage. 
            Basic Server  Functions 
              As a web designer, it is  important that you have some level of familiarity with the following elements  of the web server. 
            Root directory 
            When a browser requests a document, the server locates the  document, starting with the document root directory. This is the directory that  has been configured to contain all documents intended to be shared via the Web.  The root directory does not necessarily appear in the URL that points to the  document, so it is important to know what your root directory is when uploading  your files. 
            For example, if the root directory on littlechair.com is /users/httpd/www/ and a browser makes a request for http://www.littlechair.com/super/cool.html,  the server actually retrieves /users/httpd/www/super/cool.html. This, of  course, is invisible to the user. 
            Index files 
            A forward slash (/) at the end of  a URL indicates that the URL is pointing to a directory, not a file. By  default, servers display the contents of the directory specified in the URL.  Most servers are configured, however, to display a specific file, called the index  file, instead of the directory list. The index file is generally named index.html,  but on some servers it may be named welcome.html or default.html.  This is another small variation you will need to confirm with your server administrator. 
            If the server is configured to look  for the index file and does not find one, the directory contents may be  displayed instead, leaving your files vulnerable to snooping. For this reason,  it is a good idea to always name some page (usually the main page) in each  directory “index.html” (or an otherwise specified name). 
            HTTP response  header 
            Once the server locates the file,  it sends the contents of that file back to the browser, along with some HTTP  response headers. The headers provide the browser with information about  the arriving file, including its media type (also known as “content type” or  “MIME type”). Usually, the server will determine the format from the file’s  suffix; for example, a file with the suffix .gif is taken to be an image file. 
            The browser reads the header  information and determines how to handle the file, either displaying it in the  window or launching the appropriate helper application or plug-in. MIME types  are discussed further at the end of this chapter. 
            CGI scripts 
            Instead of pointing to an HTML  file, a URL may request that a CGI program be run. CGI stands for Common  Gateway Interface, and it’s what allows the web server to communicate with  other programs (CGI scripts) that are running on the server. CGI scripts are  commonly written in the Perl, C, or C++ languages. 
            CGI scripts can be used to  perform a wide variety of functions such as searching, server-side imagemap  handling, and gaming; however, their most common usage is forms processing.  
            Most server administrators follow  the convention of keeping CGI scripts in a special directory named cgi-bin (short  for CGI-binaries). Keeping them in one directory makes it easier to manage and  secure the server. When a CGI script is requested by the browser, the server  performs the function and returns the dynamic content to the browser. 
            Next >> Web Services   |