Managing server content


ou can use the Server Manager to help manage your server's content. You create HTML pages and other files such as graphics, text, sound, or video, and then you store those files on your server. When clients connect to your server, they can view your files provided they have access to them. This chapter describes how you can configure and manage your server's content.

 

Setting the primary document directory

You probably don't want to make all the files on your file system available to remote clients. An easy way to restrict access is to keep all of your server's documents in a central location--known as the document root or primary document directory.

 Another benefit of the document directory is that you can move your documents to a new directory (perhaps on a different disk) without changing any of your URLs because the paths specified in the URLs are relative to the primary document directory.

 For example, if your document directory is /usr/netscape/suitespot/htmldocs, a request such as http://www.mozilla.com/products/info.html tells the server to look for the file in /usr/netscape/suitespot/htmldocs/products/info.html. If you change the document root (that is, you move all the files and subdirectories), you only have to change the document root that the server uses, instead of mapping all URLs to the new directory or somehow telling clients to look in the new directory.

 To set your server's primary document directory:

  1. From the Server Manager, choose Content Management|Primary Document Directory.

  2. In the Primary Directory field, type the full pathname of the directory that you want to make the primary document directory.

  3. Click OK.

  4. Click Save and Apply to confirm your changes.

Setting additional document directories

Most of the time, you keep all of your documents in the primary document directory. Sometimes, though, you may want to serve documents from a directory outside of your document root. You can do this by setting additional document directories. By serving from a document outside of your document root, you can let someone manage a group of documents without giving them access to your primary document root.

If you expect web publishing users to publish documents to a directory, you need to set the Unix file permissions to give them write access to that directory. You should also disable write permissions for directories you do not want them to publish to.

 To add an additional document directory you first need to choose the URL prefix to map. Clients send this URL to the server when they want documents. Next, you specify the directory to map those URLs to. Finally, you might want to use an existing configuration style to specify how this directory should be configured.

To add additional document directories:

  1. Choose Content Management|Additional Document Directories.

  2. Type the URL prefix you want to map. (For example, a mapped URL could be http://www.mozilla.com/marketing/index.html where marketing/ is the prefix you specify.)

  3. Type the absolute path of the directory you want the URL prefix to map to. For example, it could be /usr/marketing/pubdocs/index.html.

  4. If you want to, select a configuration style to apply to this directory's configuration.

  5. Click OK.
Note
When you update information, but don't save and apply changes, your information is retained so that you can view and edit it, even though the changes have not taken effect.
By default, the server has three additional document directories. They have the following prefixes: You should restrict access to these directories so that users cannot write to them.

 

Customizing user public information directories

Sometimes users want to maintain their own web pages. You can configure public information directories that let all the users on your server create home pages and other documents without your intervention.

Another way to do this is to create a URL mapping to a central directory that all of your users can modify.
With this system, clients can access your server with a certain URL that the server recognizes as a public information directory. For example, suppose you choose the prefix ~ and the directory public_html. If a request comes in for http://www.netscape.com/~jdoe/aboutjane.html, the server recognizes that ~jdoe refers to a users' public information directory. It looks up jdoe in the system's user database and finds Jane's home directory. The server then looks at ~/jdoe/public_html/aboutjane.html.

To configure your server to use public directories, you need to choose a user URL prefix. The usual prefix is ~ because the tilde character is the standard Unix prefix for accessing a user's home directory. Next, you need to choose the subdirectory in the user's home directory where the server looks for HTML files. A typical directory is public_html.

The server needs to know where to look for a file that lists users on your system. The server uses this file to determine valid usernames and to find their home directories. If you use the system password file for this purpose, the server uses standard library calls to look up users. Alternatively, you can create another user file to look up users. You can specify that user file with an absolute path.

 Each line in the file should have this structure (the elements in the /etc/passwd file that aren't needed are indicated with *):

 username:*:*:groupid:*:homedir:*

You also have the option of loading the entire password file on startup. If you choose this option, the server loads the password file into memory when it starts, making user lookups much faster. If you have a very large password file, however, this option can use too much memory.

Finally, you can choose a configuration template for the server so that you can control access to other directories from public information directories. In this way you can prevent users from creating symbolic links to information you don't want made public.

 To set up user directories:

  1. From the Server Manager, choose Content Management|User Document Directories.

  2. Type the URL prefix for the user directory (~ is the default).

  3. Type the user's subdirectory. (The subdirectory public_html is the default.)

  4. Choose whether you want the server to use the system's password file or whether you want to use a user file you've created to look up users. Specify the user file with an absolute path.

  5. Choose whether you want to load the entire password file on startup.

  6. If you wish, choose a configuration style the server will use.

  7. Click OK.

Configuring document preferences

You can configure the following document preferences from the Server Manager by selecting Content Management|Document Preferences.

 

Index filenames

If a document name is not specified in the URL, and the server finds a file with this name in a document directory, it assumes that file is the index file. The server automatically displays this file when no specific file is requested. The defaults are index.html and home.html. If more than one name is specified, the server looks in the order in which the names appear in this field until one is found. For example, if your index filenames are index.html,home.html, the server first looks for index.html, and if it doesn't find it looks for home.html.

Directory indexing

In your document directory, you'll probably have several subdirectories. For example, you might create a directory called products, another called people, and so on. It's often helpful to let clients access an overview (or index) of these directories.

The server indexes directories using the following process:

Server home page

When users first access your server, they usually use an URL such as http://www.mozilla.com/. When the server receives a request for this document, it returns a document called a home page. Usually this file has general information about your server and links to other documents.

 By default the server finds the index file specified in the Index filename field and uses that for the home page. However, you can also specify a file to use as the home page by setting the radio button to Home page and entering the file name for the home page in the field next to the radio button.

 

Default MIME type

When a document is sent to a client, the server includes a section that identifies the document's type, so the client can present the document in the right way. However, sometimes the server can't determine the proper type for the document because the document's extension is not defined for the server. In those cases, a default value is sent. For information about maintaining your server's MIME types, see "Configuring MIME types" on page 81.

 The default is usually text/plain, but you should set it to the type of file most commonly stored on your server. Some common MIME types include the following:
  • text/plain
  • text/html
  • text/richtext
  • image/tiff
  • image/jpeg
  • image/gif
  • application/x-tar
  • application/postscript
  • application/x-gzip
  • audio/basic

Parsing the accept language header

When clients contact a server using HTTP 1.1, they can send header information describing the languages they accept. You can configure your server to parse this language information.

For example, if you store documents in Japanese and English, you could choose to parse the accept language header. When clients that have Japanese as the accept language header contact the server, they receive the Japanese version of the page. When clients that have English as the accept language header contact the server, they receive the English version.

 If you do not support multiple languages, you should not parse the accept language header.

 For more information on using the accept language header, see "Using the accept language header" on page 278.

 

Setting document preferences

To set document preferences:
  1. From the Server Manager, choose Content Management|Document Preferences.

  2. Type a new index filename, or add a file in the Index Filenames field.

  3. Select the kind of directory indexing you want.

  4. Select whether you want users to see a specified home page or an index file when they access your server.

  5. Type the default MIME type you want the server to return if a client accesses a file with an extension that has not been set up as a MIME type on your server.

  6. Choose whether to parse the accept language header.

  7. Click OK.

Forwarding URLs

Redirection is a method for the server to tell a user that a URL has changed (for example, because you have moved files to another directory or server). You can also use redirection to seamlessly send a person who requests a document on one server to a document on another server.

To map a URL to another server, you must first specify the prefix of the URL you want the server to redirect. Then, you need to choose which URL to redirect to. You can redirect to a URL prefix if the directory on the new server is the same as in the mapped URL; you can also redirect to a fixed URL (hostname, directory, and filename).

 To forward URLs:

  1. From the Server Manager, choose Content Management|URL Forwarding.

  2. Type the URL prefix you want to redirect. (For example, if the URL you want to map is http://www.netscape.com/info/movies, you'd type /info/movies in the field.)

  3. Choose whether you want to forward requests to a URL prefix or to a fixed URL. If you forward to a URL prefix, the forwarding keeps the full path name, and substitutes one prefix for another. For example, if you forward http://www.netscape.com/info/movies to a prefix mozilla.com, the URL http://www.netscape.com/info/movies redirects to http://mozilla.com/info/movies.

  4. However, if the directory structure on the new server is not the same as in the mapped URL, you could forward the URL to a fixed URL. For example, you could forward http://www.netscape.com/info/movies to http://mozilla.com/new-files/info/movies.

    Sometimes you may want to redirect requests for all the documents in one sub-directory to a specific URL. For example, if you had to remove a directory because it was causing too much traffic, or because the documents were no longer to be served for any reason, you could direct a request for any one the documents to a page explaining why the documents were no longer available. For example, a prefix on /info/ movies could be redirected to http://www.netscape.com/ explain.html.

  5. Click OK.

Setting up hardware virtual servers

A hardware virtual server is a way to have your server respond to multiple IP addresses without installing multiple servers. With hardware virtual servers you map multiple IP addresses to multiple document roots. For example, if you have two IP addresses, you could map the first IP address to one document root and the second IP address to a second document root. The Netscape Enterprise Server can respond to up to 256 IP addresses.

Hardware virtual servers share the same server configuration information. For example, if you turn on encryption for one hardware virtual server, any other hardware virtual servers you create would also have encryption turned on.

If you need servers that respond to different IP addresses and require that they have separate configuration information, install separate instances of the server with specific IP addresses. For more information, see "Installing multiple instances of the web server" on page 45.

 Before you set up hardware virtual servers, make sure you specified a specific bind-to address for your server on the Server Preferences|Network Settings page. If you left the Bind To Address field blank, you may experience errors when using hardware virtual servers. If you are an ISP using hardware virtual servers, the bind to address should be your main IP address.

 To set up hardware virtual servers:

  1. From the Server Manager, choose Content Management|Hardware Virtual Servers.

  2. Type the document root and its corresponding IP address in the appropriate fields.

  3. Click OK.

  4. Click Save and Apply to save and apply your changes.

  5. Repeat the previous steps for each hardware virtual server.

Setting up software virtual servers

A software virtual server is a way to host several web sites on one computer without needing to have more than one IP address on it. For example, you can set up your system so that both www.mozilla.com and www.netscape.com resolve to 192.3.4.5, then set up software virtual servers to handle both server names (for example, http://www.mozilla.com/ and http://www.netscape.com).

 The server can respond to requests differently depending upon the URL, even though the server only has one IP address. For example, one server can serve different pages for http://www.mozilla.com/ and http://www.netscape.com.

 The following example shows how software virtual servers might be used. An Internet service provider (ISP) installs a web server and then wants to set up a software virtual server for each of its customers (for example, customers aaa, bbb, and ccc) so that each customer can have an individual domain name.

The ISP first configures DNS to recognize that a customer's URL, www.aaa.com, resolves to the ISP's IP address. The ISP then creates a subdirectory for each company (aaa, bbb, and ccc) in the document root. These subdirectories contain the files for that company, including the home page, aaa/home.html. Next the ISP sets up software virtual servers. The URL host would be www.aaa.com and the home page would be aaa/home.html. The ISP would do this for all the companies.

 Because software virtual servers use the HTTP Host header to direct the user to the correct page, not all client software works with software virtual servers. Only client software (such as Netscape Navigator) which supports the HTTP Host header works. In the previous example, the ISP would set up the index.html file in the document root to be an index page that links to all the virtual servers hosted by the system, so all users could access the home pages.

 To set up a software virtual server:

  1. From the Server Manager, choose Content Management|Software Virtual Servers.

  2. Type the URL host whose custom home page you want to set up.

  3. Type the path to the home page you want to use for this virtual server. If you type a full path, the server uses that specific document. If you type a partial path, the server interprets it as relative to your primary document directory.

  4. Click OK.

  5. Click Save and Apply to apply your changes.

Assigning a character set

The character set of a document is determined in part by the language it is written in. You can override Netscape Navigator's default character set setting for a document, a set of documents, or a directory by selecting a resource and entering a character set for that resource.

Netscape Navigator can use the MIME type charset parameter in HTTP to change its character set. If the server includes this parameter in its response, Netscape Navigator changes its character set accordingly. The following are some character set examples:

The charset names recognized by Netscape Navigator are specified in RFC 1700 (except for the names that begin with x-). These charset names include the following:
  • us-ascii 
  • iso-8859-1 
  • iso-2022-jp 
  • x-sjis 
  • x-euc-jp 
  • x-mac-roman 
Additionally, the following aliases are recognized for us-ascii:
  • ansi_x3.4-1968 
  • iso-ir-6 
  • ansi_x3.4-1986 
  • iso_646.irv:1991 
  • ascii 
  • iso646-us 
  • us 
  • ibm367 
  • cp367 
The following aliases are recognized for iso_8859-1:
  • latin1 
  • iso_8859-1 
  • iso_8859-1:1987 
  • iso-ir-100 
  • ibm819 
  • cp819 
To change the character set:
  1. From the Server Manager, choose Content Management|International Characters.

  2. From the Resource Picker, choose the server resource for which you want to change the character set.

  3. In the Character Set field, enter one of the character sets mentioned in the previous paragraphs.

  4. Click OK.

  5. Click Save and Apply for your changes to take effect.

Specifying a document footer

You can specify a document footer, which can include the last-modified time, for all the documents in a certain section of your server without using server-parsed HTML. This footer works for all files except output of CGI scripts or parsed HTML (.shtml) files. If you need your document footer to appear on CGI-script output or parsed HTML files, enter your footer text into a separate file and add a line of code or another server-side include to append that file to the page's output.

 To specify a document footer:

  1. From the Server Manager, choose Content Management|Document Footer.

  2. From the Resource Picker, choose the resource to which you want to apply the document footer.

  3. Type the kind of files you want to include in the footer. The default is text/html.

  4. Choose the time format from the drop-down list, or type a custom date format in the Custom Date Format field.

  5. Enter the footer text. The maximum number of characters for a document footer is 765. Type the string :LASTMOD: if you want to include the date the document was last modified.
    Note
    Any entities (for example, &copy) are contracted after you save your changes.

  1. Click OK.

  2. Click Save and Apply to confirm your changes.
When you change the document footer for an HTML page, the last-modified date doesn't change.

Customizing parsed HTML

HTML is normally sent to the client exactly as it exists on disk without any server intervention. However, the server can search HTML files for special commands (that is, it can parse the HTML) before sending documents. If you want the server to parse these files and insert request-specific information or files into documents, you must first enable HTML parsing.

To customize parsed HTML:

  1. From the Server Manager, choose Content Management|Parse HTML.

  2. From the Resource Picker, choose the server resource to edit.

  3. Choose whether you want to activate parsed HTML. If you activate it, you need to choose whether to activate it with or without the exec tag. The exec tag allows an HTML file to execute an arbitrary program on the server. You might not want to allow the exec tag for security or performance reasons.

  4. Choose which files to parse.

Using cache-control directives

Cache-control directives are a way for the Netscape Enterprise Server to control what information is cached by a proxy server. Using cache-control directives, you override the default caching of the proxy to protect sensitive information from being cached, and perhaps retrieved later. For these directives to work, the proxy server must comply with HTTP 1.1.

For specific directories in your server, you can set the cache-control directives to one of the following levels:

To set the cache-control directives:
  1. Choose Content Management|Cache Control Directives.

  2. From the Resource Picker, choose the directory or directories for which you want to set cache-control directives.

  3. Choose the level of control you want to set. The default is public.

  4. Click OK.
For more information HTTP 1.1, see the Hypertext Transfer Protocol--HTTP/1.1 specification (RFC 2068) at:
  http://www.ietf.org/html.charters/http-charter.html

Working with configuration styles

Configuration styles are an easy way to apply a set of options to specific files or directories that your server maintains. For example, you can create a configuration style that sets up access logging. When you apply that configuration style to the files and directories that you want to log, you don't have to individually configure access logging for all the files and directories.
 

Creating a configuration style

To create a configuration style:
  1. From the Server Manager, choose Configuration Styles|New Style.

  2. Type the name you want to give the configuration style.

  3. Click OK. The Edit Configuration Style form appears.

  4. From the drop-down list, choose a configuration style to edit and click "Edit this Style."

  5. From the list of links available, click the category you want to configure for your style. You can configure the following information:
  6. Fill out the form that appears, and then click OK.

  7. Repeat Step 5 and Step 6 to make any other configuration changes to the configuration style.

  8. Click OK.

  9. Click Save and Apply to confirm your changes to the configuration style.
When you choose a style to edit, your Resource Picker lists configuration styles instead of other resources. After you have finished editing a style, click OK and Save and Apply. The Resource Picker exits the styles mode. You can also choose to exit the styles mode by choosing Exit styles mode from the Resource Picker.

 

Editing a configuration style

To edit a configuration style:
  1. From the Server Manager, choose Configuration Styles|Edit Style.

  2. From the drop-down list, choose a configuration style to edit.

  3. Click "Edit this style."

  4. From the list of links available, click the category you want to configure for your style. For more information on these categories, see "Creating a configuration style" on page 68.

  5. Fill out the form that appears, and then click OK.

  6. Repeat Step 4 and Step 5 to make any other changes to the configuration style.

  7. Click OK.

  8. Click Save and Apply to confirm your changes to the configuration style.
When you choose a style to edit, your Resource Picker lists configuration styles instead of other resources. After you have finished editing a style, click OK and Save and Apply. The Resource Picker exits the styles mode. You can also choose to exit the styles mode by choosing Exit styles mode from the Resource Picker.

 

Applying a configuration style

Once you've created a configuration style, you can apply it to files or directories in your server. You can specify either individual files and directories or wildcard patterns (such as *.gif).

 To apply a configuration style:

  1. Choose Configuration Styles|Assign Configuration Style.

  2. Enter the prefix of the URL to which you are applying this configuration style. If you choose a directory inside the document root, only enter the path after the document root. If you enter /* after the directory, you apply the configuration style to all of the directory's contents.

  3. Select the configuration style you want to apply. To remove any configuration style previously applied to the resource, apply the None configuration style.

  4. Click OK.

Removing a configuration style

Before removing a configuration style, apply the None configuration style to any files or directories that had the configuration style applied to them. If you do not do this before removing the configuration style, you must manually edit your obj.conf file, searching for the configuration style in the file and replacing it with None. If you don't do this search and replace, anyone who accesses the files or directories that had the deleted configuration style applied will get a server misconfiguration error message.

 To remove a configuration style:

  1. Choose Configuration Styles|Remove Configuration Style.

  2. Select the configuration style you want to remove.

  3. Click OK. The configuration style is removed.

Listing configuration style assignments

After you have created configuration styles and applied them to files or directories, you can get a list of the configuration styles and where you applied them.

To list configuration style assignments:

  1. From the Server Manager, choose Configuration Styles|List Assignments. The List Assignments form appears, showing the configuration styles you applied to server resources.

  2. To edit a configuration style assignment, click the Edit link next to the configuration style name.

Copyright 1997 Netscape Communications Corporation. All rights reserved.