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
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,
- Choose Content Mgmt|Primary Document Directory.
- If you want to set the primary document directory, type the full path of the directory you want to be the primary document directory.
- Click OK.
- 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,
- Choose Content Mgmt|Additional Document Directories.
- 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.)
- Type the absolute path of the directory you want the URL prefix to map to. For example, it could be /usr/ns-home/docs/sales/tools/products.
- If you'd like, select a configuration style to apply to this directory's configuration.
- 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,
- Choose Content Mgmt|User Document Directories.
- Type the URL prefix for the user directory.
- Type the user's subdirectory. (The subdirectory public_html is provided as the default.)
- 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.
- Choose whether you want to load the entire password file on startup.
- If you want, choose a configuration template the server will use.
- 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:
- Choose Content Mgmt|Remote File Manipulation.
- Choose a resource from the Resource Picker.
- Click the Yes radio button to enable remote file manipulation.
- 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.
The server either finds the index file you specified in the Index filenames field, or you can specify a file to use as the home page.
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:
For more information on MIME types, see the Programmer's Guide.
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,
- Choose Content Mgmt|URL Forwarding.
- 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.)
- Choose whether you want to forward requests to a URL prefix or to 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.
- Click OK.
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,
- From the Server Manager, choose Content Mgmt|Software Virtual Servers.
- Type the hostname whose custom home page you want to set up.
- 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.
- Click OK.
- Click Save and apply to apply your changes.
After you have set up your software virtual server, you need to make sure that its home page's links properly point to documents in the software virtual server's primary document directory. For example, suppose you set up a software virtual server called atomic.netscape.com, with its home page (index.html) and other corresponding documents in [ServerRoot]/docs/physics_dir.
In index.html, if you want to link to a file called report.html in [ServerRoot]/docs/physics_dir, create an URL mapping called physics to [ServerRoot]/docs/physics_dir, and then you could the the following full URL for the link:
<a href="http://atomic.netscape.com:/physics/report.html">
You could also place the following line in index.html (placed before you reference any links):
<base href="http://atomic.netscape.com:/physics/">
Any links to files in the primary document directory would not have to be absolute links; you could use the following relative link to report.html because the previous line defines the base.
<a href="report.html">
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 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:
The charset names recognized by Netscape Navigator are specified in RFC 1700 (except for the names that begin with "x-"). These include the following:
Additionally, the following aliases are recognized for us-ascii:
The following aliases are recognized for iso_8859-1:
To change the character set,
- Choose Content Mgmt|International Characters.
- Choose the server resource whose character set you want to change.
- Enter one of the character sets mentioned in the previous paragraphs.
- Click OK.
- 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,
- From the Server Manager, choose Content Mgmt|Document Footer.
- Enter the type of files you want to include in the footer.
- Choose the time format form the drop-down list, or enter a custom date format in the Custom Date Format field.
- 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, ©
) you enter will be expanded when you
edit the footer again. If you edit the footer again, be sure to re-expand the
entities.
- Click OK.
- 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,
- Choose Content Mgmt|Parse HTML.
- Select which server resource you'd like to edit.
- 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.
- Choose which files to parse.
Using version control
Use the version control feature built in the Netscape Enterprise Server to provide check-in, check-out, and roll-back capabilities to groups of people who are working on the same set of documents.
This section discusses the following tasks you can perform with version control:
Enabling version control
Before you can use version control, you must perform the following tasks:
To enable version control,
- Choose Content Mgmt|Version Control.
- Choose whether you want version control never active, always active, or active only for existing archives (no new archives would get created).
- Type an RCS path; the default RCS path provided (%d/rcs/%f) will create an
rcs
subdirectory in your primary document directory. (The %d represents your server's document directory; %f represents the document file name.) If you accept the default RCS path and your primary document directory is /usr/ns-home/docs
, your archived files will be located in /usr/ns-home/docs/rcs
.
- If you changed the RCS path, type a working path. If you didn't change the RCS path, you don't need to type a working path value.
For example, if you wanted archives that mirrored your primary document
directory and specified /usr/ns-home/archive
as your RCS path, you'd
need to specify a working path. If your primary document directory is
/usr/ns-home/docs
and wanted to check in
/usr/ns-home/docs/sales/france.html
, your working path would
be /usr/ns-home/docs
.
- Click OK.
Checking out documents
After you've added documents to the version control system, you can check them out and lock them so that no one can update documents that you're working on. Once you've checked out and locked a document, no one can check out and lock it until you unlock the document. Other people can still look at the document, but they won't be able to write any changes to it in the version control system. Locking protects against two people making simultaneous changes to a document.
To check out and lock a document, type the URL for the document with ;version=head:lock
appended to it. For example, if you have a document called overview.html
in the primary document directory on a server named www.a.com, you'd type the following as the URL in Netscape Navigator in order to check out and lock overview.html
:
http://www.a.com/overview.html;version=head:lock
Retrieving documents
You can retrieve documents from the version control system without locking them, which is useful if you only want to look at a document. You can retrieve a document by specifying a specific version number or label name, and you can retrieve the latest version. If you're going to make changes to a document and want to ensure no one else will make changes to it, follow the instructions in the previous section.
To retrieve a specific version of a document, type the document URL with ;version=[version_number]
appended to it. For example, to see version 6 of overview.html, you'd type the following:
http://www.a.com/overview.html;version=1.6
To retrieve the latest version of a document, type the document URL with ;version=head
appended to it. For example, if you wanted to see the latest version of overview.html
, type the following:
http://www.a.com/overview.html;version=head
or
http://www.a.com/overview.html;version=
Checking in documents
Use Netscape Navigator Gold, which is included with your server (or any other authoring tool that supports HTTP PUT) to check in documents. Make sure you enable access control and only allow appropriate people write access to the server. For more information on access control, see the "Restricting access" section in Chapter 6.
To check in a document, do the following using Navigator Gold for Windows NT:
- Click the Publish button (or choose File|Publish).
- Make sure the Local files settings are as you want them. For help on these settings, click Help.
- Type the directory path, appended with
;version=head:update
in the Upload files to this location text box. (The document name will automatically be appended to the directory path.) This URL checks in the document and unlocks it. For example, to check in overview.html, type the following:
http://www.a.com/;version=head:update
To check in a document and keep the lock on it, type the following:
http://www.a.com/;version=head:lock:update
- Type your authentication user name and password in order to write to the server.
- Click OK.
The document is checked in. The document you checked in will be the
default document that is retrieved if no version number is specified during
the request.
Unlocking a document without checking it in
If you want to unlock a document without checking it in with any changes, type the document URL in Navigator with ;version=head:unlock
appended to it.
Retrieving a list of versions of a document
To see a list of the versions of a document, type the URL for the document with ;version=index
appended to it in your network navigator.
For example, if you wanted to see a list of versions of a document in your primary document directory called relnotes.html
, you'd type the following as an URL:
http://www.a.com/relnotes.html;version=index
A page listing all the versions of relnotes.html
appears, Other information such as document author and creation dates is also listed. You can click on a version link to see that version of the document.
Retrieving previous document revisions
You can retrieve previous revisions of a document in two ways:
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,
- Choose Config Styles|New Style.
- Type the name you want to give the configuration style.
- Click OK. The Edit Configuration Style form appears.
- Choose a configuration style to edit.
- From the list of links available, click the one you want to configure for your style.
- CGI file type--Allows you to activate CGI. For more information about CGI, see Chapter 7.
- Character Set--Allows you to change the character set for a resource. For more information about character sets, see "Assigning a character set" in Chapter 4.
- Default Query Handler--Allows you to set a default query handler for a server resource. For more information about query handling, see "Setting a query handler" in Chapter 7.
- Document Footer--Allows you to add a document footer to a server resouce. For more information about document footers, see "Specifying a document footer" in Chapter 4.
- Dynamic Configuration--Allows you to give people a subset of configuration options without allowing them access to the Server Manager. For more information about dynamic configuration, see "Working with dynamic configuration files."
- Error Responses--Allows you customize error responses clients see when they encounter an error from your server. For more information about error responses, see "Customizing error responses."
- Log preferences--Allows you to set preferences for access logs. For more information about log preferences, see "Setting log preferences" in Chapter 9.
- Remote File Manipulation--Allows you to enable clients to change your server's content. Make sure you have access control set up to protect areas of your server you don't want people to access. (See Chapter 6 for more information on access control.) For more information about remote file manipulation, see "Enabling remote file manipulation" in Chapter 4.
- Require Stronger Security--Allows you to set up encryption strength for your server. For more information about encryption strength, see the "Specifying stronger encryption strength" section in Chapter 7.
- Restrict Access--Allows you to restrict access to the entire server or parts of it. For more information about access control, see the "Restricting access" section in Chapter 6.
- Server Parsed HTML--Allows you to enable the server to parse files before they are sent to the client. For more information about using parsed HTML, see "Customizing parsed HTML" in Chapter 4.
- Symbolic links--Allows you to limit the use of filesystem links in your server. For more information about symbolic links, see "Restricting symbolic links."
- Fill out the form that appears, and then click OK.
- Repeat steps 4 and 5 to make any other configuration changes to the configuration style.
- Click OK.
- Click Save and Apply to confirm your changes to the configuration style.
Editing a configuration style
To edit a configuration style,
- Choose Config Styles|Edit Style.
- Choose a configuration style to edit.
- Click Edit this style.
- From the list of links available, click the one you want to configure for your style.
- CGI file type--Allows you to activate CGI. For more information about CGI, see Chapter 7.
- Character Set--Allows you to change the character set for a resource. For more information about character sets, see "Assigning a character set" in Chapter 4.
- Default Query Handler--Allows you to set a default query handler for a server resource. For more information about query handling, see "Setting a query handler" in Chapter 7.
- Document Footer--Allows you to add a document footer to a server resouce. For more information about document footers, see "Specifying a document footer" in Chapter 4.
- Dynamic Configuration--Allows you to give people a subset of configuration options without allowing them access to the Server Manager. For more information about dynamic configuration, see "Working with dynamic configuration files."
- Error Responses--Allows you customize error responses clients see when they encounter an error from your server. For more information about error responses, see "Customizing error responses."
- Log preferences--Allows you to set preferences for access logs. For more information about log preferences, see "Setting log preferences" in Chapter 9.
- Remote File Manipulation--Allows you to enable clients to change your server's content. Make sure you have access control set up to protect areas of your server you don't want people to access. (See Chapter 6 for more information on access control.) For more information about remote file manipulation, see "Enabling remote file manipulation" in Chapter 4.
- Require Stronger Security--Allows you to set up encryption strength for your server. For more information about encryption strength, see the "Specifying stronger encryption strength" section in Chapter 7.
- Restrict Access--Allows you to restrict access to the entire server or parts of it. For more information about access control, see the "Restricting access" section in Chapter 6.
- Server Parsed HTML--Allows you to enable the server to parse files before they are sent to the client. For more information about using parsed HTML, see "Customizing parsed HTML" in Chapter 4.
- Symbolic links--Allows you to limit the use of filesystem links in your server. For more information about symbolic links, see "Restricting symbolic links."
- Fill out the form that appears, and then click OK.
- Repeat steps 3 and 4 to make any other configuration changes to the configuration style.
- Click OK.
- 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,
- Choose Config Styles|Remove Configuration Style.
- Select the configuration style you want to remove.
- 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,
- Choose Config Styles|Assign Configuration Style.
- 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.
- 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.
- 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:
- Choose Config Styles|List Assignments.
The List Assignments form appears, showing the configuration styles you
applied to server resources.
- To edit a configuration style assignment, click on the Edit link next to the configuration style name.