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:
-
From the Server Manager, choose Content Management|Primary Document Directory.
-
In the Primary Directory field, type the full pathname of the directory
that you want to make 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 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:
-
Choose Content Management|Additional Document Directories.
-
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.)
-
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.
-
If you want to, select a configuration style to apply to this directory's
configuration.
-
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:
-
/search-ui
-
/webpub-ui
-
/publisher
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:
-
From the Server Manager, choose Content Management|User Document Directories.
-
Type the URL prefix for the user directory (~ is the default).
-
Type the user's subdirectory. (The subdirectory public_html is
the default.)
-
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.
-
Choose whether you want to load the entire password file on startup.
-
If you wish, choose a configuration style the server will use.
-
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:
-
The server first searches the directory for an index file called index.html
or home.html, which is a file you create and maintain as an overview
of the directory's contents. (Note that these defaults are configurable
for the whole server, so your server's files may vary. For more information,
see "Index filenames" on page 57). You
can specify any file as an index file for a directory by naming it one
of these default names, which means you can also use a CGI program as an
index if CGI is activated.
-
If an index file isn't found, the server generates an index file that lists
all the files in the document root. The generated index has one of the
following formats:
-
"Fancy" directory indexing is fairly detailed. It includes a graphic that
represents the type of file, the date the file was last modified, and the
file size.
-
Simple directory indexing is less detailed but takes less time to generate.
-
You can also specify that no dynamic directory listing be generated if
the server looks for index files and cannot find any. If the server does
not find any index files, it will not create a directory listing to show
the user and will return an error message.
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:
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:
-
From the Server Manager, choose Content Management|Document Preferences.
-
Type a new index filename, or add a file in the Index Filenames field.
-
Select the kind of directory indexing you want.
-
Select whether you want users to see a specified home page or an index
file when they access your server.
-
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.
-
Choose whether to parse the accept language header.
-
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:
-
From the Server Manager, choose Content Management|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. 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.
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.
-
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:
-
From the Server Manager, choose Content Management|Hardware Virtual Servers.
-
Type the document root and its corresponding IP address in the appropriate
fields.
-
Click OK.
-
Click Save and Apply to save and apply your changes.
-
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:
-
From the Server Manager, choose Content Management|Software Virtual Servers.
-
Type the URL host whose custom home page you want to set up.
-
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.
-
Click OK.
-
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:
-
Content-Type: text/html;charset=iso-8859-1
-
Content-Type: text/html;charset=iso-2022-jp
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:
Additionally, the following aliases are recognized
for us-ascii:
The following aliases are recognized for iso_8859-1:
To change the character set:
-
From the Server Manager, choose Content Management|International Characters.
-
From the Resource Picker, choose the server resource for which you want
to change the character set.
-
In the Character Set field, 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. 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:
-
From the Server Manager, choose Content Management|Document Footer.
-
From the Resource Picker, choose the resource to which you want to apply
the document footer.
-
Type the kind of files you want to include in the footer. The default is
text/html.
-
Choose the time format from the drop-down list, or type a custom date format
in the Custom Date Format field.
-
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, ©)
are contracted after you save your changes.
-
Click OK.
-
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:
-
From the Server Manager, choose Content Management|Parse HTML.
-
From the Resource Picker, choose the server resource to edit.
-
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.
-
Choose which files to parse.
-
The common (and default) choice is to parse only files with the extension
.shtml. In this case, all files you want to parse must have the
.shtml extension.
-
Another choice is to parse files whose Unix permissions specify that the
execute bit is on. Using the execute permissions can be unreliable because
some files that are not executable have the bit set.
-
You can have the server parse all of its HTML files. Choosing this option
can slow your server's performance.
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:
-
Public. The response is cacheable by any cache.
-
Private. The response is only cacheable by a private (nonshared) cache.
-
No cache. The response must not be cached anywhere.
-
No store. The cache must not store the request or response anywhere in
nonvolatile storage.
-
Must revalidate. The cache entry must be revalidated from the originating
server.
-
Maximum age (in seconds). The client does not accept a response that has
an age greater than this age.
To set the cache-control directives:
-
Choose Content Management|Cache Control Directives.
-
From the Resource Picker, choose the directory or directories for which
you want to set cache-control directives.
-
Choose the level of control you want to set. The default is public.
-
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:
-
From the Server Manager, choose Configuration Styles|New Style.
-
Type the name you want to give the configuration style.
-
Click OK. The Edit Configuration Style form appears.
-
From the drop-down list, choose a configuration style to edit and click
"Edit this Style."
-
From the list of links available, click the category you want to configure
for your style. You can configure the following information:
-
CGI file type--Allows you to activate CGI as a file type. For more information
about CGIs, see "Installing CGI programs"
on page 145.
-
Character Set--Allows you to change the character set for a resource. For
more information about character sets, see "Assigning
a character set" on page 64.
-
Default Query Handler--Allows you to set a default query handler for a
server resource. For more information about query handling, see "Using
the query handler" on page 148.
-
Document Footer--Allows you to add a document footer to a server resource.
For more information about document footers, see "Specifying
a document footer" on page 65.
-
Dynamic Configuration--Allows you to give people a subset of configuration
options without giving them access to the Server Manager. For more information
about dynamic configuration, see "Working
with dynamic configuration files" on page 86.
-
Error Responses--Allows you to customize the error responses that clients
see when they encounter an error from your server. For more information
about error responses, see "Customizing error
responses" on page 85.
-
Log preferences--Allows you to set preferences for access logs. For more
information about log preferences, see "Setting
log preferences" on page 162.
-
Restrict Access--Allows you to restrict access to the entire server or
parts of it. For more information about access control, see "Restricting
access" on page 102.
-
Server Parsed HTML--Allows you to specify whether the server parses files
before they are sent to the client. For more information about using parsed
HTML, see "Customizing parsed HTML" on page
66.
-
Symbolic links--Allows you to limit the use of filesystem links in your
server. For more information about symbolic links, see "Restricting
symbolic links" on page 94.
-
Fill out the form that appears, and then click OK.
-
Repeat Step 5 and Step
6 to make any other configuration changes to the configuration style.
-
Click OK.
-
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:
-
From the Server Manager, choose Configuration Styles|Edit Style.
-
From the drop-down list, choose a configuration style to edit.
-
Click "Edit this style."
-
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.
-
Fill out the form that appears, and then click OK.
-
Repeat Step 4 and Step
5 to make any other changes to the configuration style.
-
Click OK.
-
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:
-
Choose Configuration Styles|Assign Configuration Style.
-
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.
-
Select the configuration style you want to apply. To remove any configuration
style previously applied to the resource, apply the None configuration
style.
-
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:
-
Choose Configuration Styles|Remove Configuration Style.
-
Select the configuration style you want to remove.
-
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:
-
From the Server Manager, choose Configuration Styles|List Assignments.
The List Assignments form appears, showing the configuration styles you
applied to server resources.
-
To edit a configuration style assignment, click the Edit link next to the
configuration style name.
Copyright 1997 Netscape Communications Corporation.
All rights reserved.