Managing server content

ou can use the Server Manager to help manage your server's content.

Setting the primary document directory

For a public server, you probably don't want to make all the files on your file system available to remote clients. The easiest way make sure this does not happen is to keep all of your server's documents in a central location--known as the primary document directory (or document root).

Another benefit of the primary 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 URL are relative to the primary document directory.

For example, if your document directory is /usr/htmldocs, a request such as http://www.a.com/products/info.html tells the server to look for the file in /usr/htmldocs/products/info.html. If you change the document directory (that is, you move all the files and subdirectories), you only have to change the document directory 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, do the following:

  1. Choose Content Mgmt|Primary Document Directory.
  2. If you want to set the primary document directory, type the full path of the directory you want to be 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 want to refer to a directory outside of your document root. You can do this by setting additional document directories.

First, choose the URL prefix to map. This is the URL clients send 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 other document directories, do the following:

  1. Choose Content Mgmt|Additional Document Directories.
  2. Type the URL prefix you want to map. (For example, a mapped URL could be http://www.a.com/products/index.html where products/ is the prefix you specify.)
  3. Type the absolute path of the directory you want the URL prefix to map to. (For example, the directory could be called /usr/ns-home/docs/sales/tools/products. It should be a full system path. )
  4. If you'd like, select a configuration style to apply to this directory's configuration.
  5. Click OK.

Customizing user public information directories

You can configure public information directories that let all the users on your machine 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 used is ~ because it's a character that is rarely used. Next, you need to choose the subdirectory where the server looks for user home directories. 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 user names and to find their home directories. You can use the system password file for this, which means the server uses standard library calls to look up users. Or, you can create another user file to use 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 can use too much memory.

Finally, you can choose a configuration template that the server uses so that you can control what is allowed from public information directories. This can prevent users from creating symbolic links to information you don't want made public, and so on.

To set up user directories, do the following:

  1. Choose Content Mgmt|User Document Directories.
  2. Type the URL prefix for the user.
  3. Type the user's subdirectory. (The subdirectory public_html is provided as the default.)
  4. Choose whether you want the server to use the system's password file, or if you want to use a user file you've created to look up users. Specify the user file with an absolute link.
  5. Choose whether you want to load the entire password file on startup.
  6. If you want, choose a configuration template the server will use.
  7. Click OK.

Enabling remote file manipulation

Enabling remote file manipulation allows clients to change your server's documents. Make sure you select only resources that you want clients to write to. Use access control to restrict write access on these resources. For more information about access control, see Chapter 6.

To enable remote file manipulation, do the following from the Server Manager:

  1. Choose Content Mgmt|Remote File Manipulation.
  2. Choose a resource from the Resource Picker.
  3. Click the Yes radio button to enable remote file manipulation.
  4. Click OK.

Configuring document preferences

You can configure your server's document preferences using the Server Manager:

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.

There are two ways the server can do this:

Server home page

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

You can either specify a file in the document root as the home page, or the server will create an index file instead.

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 knows what to do with the document. However, sometimes the server can't determine the proper type for the document. In those cases, a default value is sent.

The default is usually text/plain, but it should reflect the most common type of file stored in your server. Some common types include the following:

Forwarding URLs

Redirection is a method for the server to tell a user that a URL has changed (for example, if you move files to another directory or server). You can also use redirection to seamlessly send a person from your server to another.

To map a URL to another server, you must first specify the URL prefix 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, do the following:

  1. Choose Content Mgmt|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 forward requests to a URL prefix or a fixed URL. (For example, http://w3.a.com/ is an example of a URL prefix. A fixed URL might be http://w3.com/new-files/info/movies.)
  4. Click OK.

  5. Click Save and Apply to save and apply your changes.
  6. Repeat the previous steps for each hardware virtual server.

Setting up software virtual servers

If your system handles an IP address that is mapped to serveral server names (for example, if www.a.com and www.b.com resolve to 192.3.4.5), then you can set up software virtual servers to handle http://www.a.com/ and http://www.b.com

You can set up your server to answer requests to different URLs but only have one numeric IP address. For example, one server with an IP address can serve different pages for http://www.a.com/ and http://www.b.com. Some client software, such as Netscape Navigator 2.0, sends a Host header that tells the server which host the client is accessing. When you specify a home page for a virtual software server when creating it, you allow any clients who use client software that does not send a Host heading to access the correct information.

An example of how software virtual servers might be used would be if an Internet service provider (ISP), www.company.com, installed a web server and then set up a software virtual server for each of its customers who wanted to set up a web server with individual domain names.

The ISP would first configure DNS to recognize that www.aaa.com points to their system. They would then create a subdirectory named aaa in the primary document directory, put the home page for www.aaa.com in the aaa directory, and set up a software virtual server for www.aaa.com to use the file aaa/aaahomepage.html as its home page. That home page might have links to aaa/mygraphic.gif, aaa/myprices.html, and other files in the aaa subdirectory. Each additional customer would have their own directory on the www.company.com web server and their own software virtual server. If users tried to connect with older client software, they would see the www.company.com home page, which could be set up as an index to all the other web servers hosted by the system.

To set up a software virtual server,

  1. From the Server Manager, choose Content Mgmt|Software Virtual Servers.
  2. Type the hostname 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. Typing a full path will use that specific document. Typing a partial path will be interpreted as being 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, set of documents, or directory by selecting a resource and entering a character set for that resource below.

Netscape Navigator is able to change its character set (if the character set is available) using the MIME Charset parameter in HTTP. If the server includes this parameter in its response, Netscape Navigator will change its character set appropriately. The following are examples:

  1. Choose Content Mgmt|International Characters.
  2. Choose the server resource whose character set you want to change.
  3. 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 (except output of CGI scripts or parsed HTML (.shtml) files). If you need your document footer to appear on these kinds of pages, enter your footer text into a separate file and add a line of code or another server-side include to specifically append that file to the page's output.

To specify a document footer, do the following:

  1. From the Server Manager, choose Content Mgmt|Document Footer.
  2. Enter the type of files you want to include in the footer.
  3. Choose the time format form the drop-down list, or enter a custom date format in the Custom Date Format field.
  4. Enter the text you want in the footer. Note that the maximum number of characters for a document footer is 765. Type the string :LASTMOD: if you want to include the last-modification date. Note: Any entities (for example, &copy) you enter will be expanded when you edit the footer again. If you do edit it again, be sure to re-expand the entities.

  5. Click OK.
  6. Click Save and Apply to confirm your changes. When you change the document footer for an HTML page, you are not changing the last-modified time stamp.

Customizing parsed HTML

HTML is normally sent to the client exactly as it exists on disk without any server intervention. If you want to have the server parse these files and insert request-specific information or files into documents, you can use parsed HTML.

To customize parsed HTML,

  1. Choose Content Mgmt|Parse HTML.
  2. Select which server resource you'd like to edit.
  3. Choose whether you want to activate parsed HTML. If you do, you need to choose whether to activate it with the exec tag. The exec tag allows an HTML file to execute an arbitrary program on the server; you might not want to activate it for security or performance reasons.
  4. Choose which files to parse.

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. You apply that configuration style to the files and directories you want to log, saving you from individually configuring access logging for all the files and directories.

If you're editing a configuration style, choose Exit styles mode from the Resource Picker to stop editing the configuration style. You don't need to exit the styles mode after you've finished editing a configuration style; the Server Manager exits the styles mode automatically.

Creating a configuration style

To create a configuration, do the following:

  1. Choose Config Styles|New Style.
  2. Type the name you want to give the configuration style.
  3. Click OK. The Edit Configuration Style form appears.
  4. Choose a configuration style to edit.
  5. From the list of links available, click the one you want to configure for your style.
  6. Fill out the form that appears, and then click OK.
  7. Repeat steps 4 and 5 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.

Editing a configuration style

To edit a configuration style, do the following:

  1. Choose Config Styles|Edit Style.
  2. Choose a configuration style to edit.
  3. Click Edit this style.
  4. From the list of links available, click the one you want to configure for your style.
  5. Fill out the form that appears, and then click OK.
  6. Repeat steps 3 and 4 to make any other configuration changes to the configuration style.
  7. Click OK.
  8. Click Save and Apply to confirm your changes to the configuration style.

Removing a configuration style

When you remove a configuration style, the configuration style is deleted from the obj.conf file (it was stored as a named object). The configuration style isn't unapplied from any resources you have applied it to. Before removing a configuration style, apply the None configuration style to any files or directories first. You can also remove a configuration style and then search and replace all instances of the configuration style in obj.conf. If you don't remove these entries, anyone who accesses the files or directories that had the configuration style applied will get a server misconfiguration error message.

To remove a configuration style, do the following:

  1. Choose Config Styles|Remove Configuration Style.
  2. Select the configuration style you want to remove.
  3. Click OK. The configuration style is removed.

Applying configuration styles

You can apply configuration style to files or directories in your server. You can either specifically choose files and directories, or you can specify wildcard patterns (such as *.gif).

To apply a configuration style, do the following:

  1. Choose Config Styles|Assign Configuration Style.
  2. Enter the URL prefix to apply this configuration style to. If the directory you want to choose is inside the document root, only enter the path after the document root. If you enter /* after the directory, all of the directory's contents will have the configuration style applied.

  3. Select the configuration style you want to apply. The None configuration style can be applied to files or directories to remove any configuration style previously applied to the resource.
  4. Click OK.

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 they're applied.

To list configuration style assignments, do the following from the Server Manager:

  1. Choose Config 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 on the Edit link next to the configuration style name.