Sun Java System Web Server 6.1 SP11 Administrator's Guide

Chapter 14 Creating and Configuring Virtual Servers

A class of virtual servers has virtual servers (members of the class) associated with it. You can override some of the class-level settings at the virtual server level. This chapter describes how you can create and configure individual virtual servers. For information on configuring virtual server classes, see Chapter 17, Content Management. For an overview of virtual servers, see Chapter 14, Using Virtual Servers.

This chapter contains the following sections:

Creating a Virtual Server

Virtual servers allow you, with a single installed server, to offer companies or individuals domain names, IP addresses, and some server administration capabilities. For an introduction to virtual servers and how to set them up in the Sun Java System Web Server, see Chapter 14, Using Virtual Servers.

To create a virtual server, perform the following steps.

ProcedureTo create a virtual sever

  1. From the Class Manager, choose the Virtual Servers tab.

  2. Click Add Virtual Server.

  3. Choose a name for the virtual server.

  4. Choose a URL host for the virtual server.

    You can type more than one URL host, separated by spaces.

  5. Click OK.

    These settings are all that is required for creating a virtual server. However, you can configure additional virtual server settings using other pages on this tab.

Editing Virtual Server Settings

Once you have set up your virtual servers, you can edit them. You can make these changes two ways: using the Class Manager or the Virtual Server Manager.

On the Class Manager, the pages are organized by the kind of setting you want to change. For example, you can go to the Quality of Service page to change the Quality of Service settings for one or more virtual servers in the class.

On the Virtual Server Manager, the pages only pertain to one virtual server, so you can see and change all of its settings.

Editing Using the Class Manager

Use the following Class Manager pages to edit virtual server settings.

Editing Virtual Server Settings

To edit the general settings of a virtual server, use the Edit Virtual Servers page. To access this page, follow these steps:

ProcedureTo edit the general settings of a virtual server

  1. From the Class Manager, click the Virtual Servers tab.

  2. Click Edit Virtual Servers.

  3. To edit a virtual server, click From the drop-down list next to the virtual server you want, choose Edit or Delete.

    The default virtual server can only be edited and not deleted.

  4. Set the State to On, Off, or Disabled.

    If you set the state to Disabled, you can turn the server back on, but the end user of the server cannot.

    This state is the virtual server’s state, which is independent of whether the server instance is on or off. If a virtual server’s state displayed on this page is on, the virtual server can only accept requests if the server instance is running as well.

    This is true of the default virtual server for the default server instance as well. If you turn off your server instance, your default virtual server is still set to on, but will not accept connections.

    You cannot turn off or disable the default virtual server for the server instance.

  5. Type the URL Hosts you want to use, if different than displayed under Urlhosts column.

    You can type more than one URL host, separated by spaces.

  6. When you are through editing virtual servers click OK.

Configuring Virtual Server MIME Settings

You can set the MIME types file for an individual virtual server. The MIME types file contains the mappings of file extensions to types of files. For example, the MIME types file is where you can specify that all files ending .cgi be treated as CGI files.

You do not need to create a separate MIME types file for each virtual server or virtual server class. Instead, you create as many MIME types files as you need and associate them with a virtual server. One MIME types file, mime.types, exists by default on the server. To create new MIME types files, or to edit the definitions in a MIME Types file, see Choosing MIME Types.

To set the MIME types file for a specific virtual server, follow these steps

ProcedureTo set the MIME types file for a specific virtual serve

  1. From the Class Manager, click the Virtual Servers tab.

  2. Click MIME Settings.

  3. Choose a MIME types file from the drop-down list next to the virtual server.

  4. Click OK.

Configuring Virtual Server ACL Settings

You can use ACLs to control access to virtual servers. Each virtual server can have a different base DN in the LDAP database, so that each virtual server can have its own entries in a the single LDAP database used by the Sun Java System Web Server.

For more information, see Controlling Access for Virtual Servers.

Configuring Virtual Server Security

You can set security for a virtual server if that virtual server is bound to a secure listen socket.

For more information on security, see Chapter 5, J2SE-based Security for Web Container and Web Applications.

Configuring Virtual Server Quality of Service Settings

Quality of service refers to the performance limits you set for a virtual server. For example, an ISP might want to charge different amounts of money for virtual servers depending on how much bandwidth allowed them.

You can enable these settings for the entire server or for a class of virtual servers in the Server Manager, from the Status tab. However, you can override these server or class-level settings for an individual virtual server.

Before enabling quality of service for a virtual server, you must first enable it for the entire server, and also set some basic values. See Using Quality of Service.

To configure the quality of service settings for a virtual server, follow these steps

ProcedureTo configure the quality of service settings for a virtual server

  1. From the Class Manager, click the Virtual Servers tab.

  2. Click Quality of Service.

    A page appears listing all the virtual servers in the class and their quality of service settings.

  3. To enable quality of service for a virtual server, choose Enable from the drop-down list.

    By default quality of service is disabled. Enabling quality of service increases server overhead slightly.

  4. Set the maximum bandwidth, in bytes per second, for the virtual server.

  5. Choose whether or not to enforce the maximum bandwidth setting.

    If you choose to enforce the maximum bandwidth, connections are refused, once the server reaches its bandwidth limit additional.

    If you do not enforce the maximum bandwidth, when the maximum is exceeded the server logs a message to the error log.

  6. Choose the maximum number of connections allowed for the virtual server.

    This number is the number of concurrent requests processed.

  7. Choose whether to enforce the maximum connections setting.

    If you choose to enforce the maximum connections, additional connections are refused, once the server reaches its limit .

    If you do not enforce the maximum connections, when the maximum is exceeded the server logs a message to the error log.

  8. Click OK.

    For more information on the quality of service features, see Using Quality of Service.

Configuring Virtual Server Log Settings

To change the location of the virtual server’s access and error logs from the default, follow these steps

ProcedureTo change the location of the virtual server's access and error logs

  1. From the Class Manager, click the Virtual Servers tab.

  2. Click Logging Settings.

    A page appears listing all the virtual servers in the class and the location of their error logs.

  3. Enter an absolute path to the error and access logs. The path must already exist.

    By default, the access and error messages for all virtual servers are logged to the server instance’s access and error logs. If you want virtual servers to have separate log files, you set that up in this step.

  4. If you want to change the paths back to the default, click Default.

  5. Click OK.

    To look at the logs for a particular virtual server, follow these steps:

  6. From the Virtual Server Manager choose the Logs tab.

  7. Click View Access Log or View Error Log.

  8. Choose the number of entries to display and the criteria for displaying them.

    For example, if your logs contain entries for all virtual servers, you can choose to display only the entries for a particular virtual server.

  9. Click OK.

Enabling Logging for a Virtual Server

To enable virtual server level logging, perform the following steps

ProcedureTo enable virtual server level logging

  1. Go to the Logs tab in the Server Manager for the server instance and select Log Preferences.

  2. Create a new access log by entering the path and file name in the Log File field.

    You can also manually create a new access log in magnus.conf by changing

    Init fn=init access="$accesslog" to Init fn=init access="newaccesslog"

  3. Select Only Log under Format and check Virtual Server Id.

    For a custom format, select Custom Format and add %vsid% to the end of the line.

    %vsid% is useful when using multiple virtual servers. This entry records vsid in the access log.

    You can also manually add %vsid% to the end of Init fn in the magnus.conf file.

  4. Click OK.

  5. Click Apply.

  6. Click Apply Changes for your changes to take effect.

Configuring Virtual Server Java Web Application Settings

A web application is a collection of Java servlets, JSPs, HTML pages, classes and other resources. All the resources are stored in a directory, and all requests to that directory run the application. Use the pages under the Web Applications tab of the Virtual Server Manager to deploy and edit web applications for a specific virtual server.

For more information on web applications and the deployment descriptor file for web applications,sun-web.xml, see the Sun Java System Web Server 6.1 SP11 Administrator’s Configuration File Reference.

Editing Using the Virtual Server Manager

The Virtual Server Manager contains four tabs: Preferences, Logs, Web Applications, and WebDAV.

The Preferences tab contains pages for:

The Status page lists some settings and provides links to the virtual server’s access and error logs.

The Settings page contains the following settings for a virtual server:

If you are editing a single virtual server, it is convenient to use the Virtual Server Manager and change all these settings on one page.

The Logs tab contains a single page allowing you to generate reports for the selected virtual server.

For more information about deploying and editing web application files, see Chapter 16, Extending Your Server With Programs.

The WebDAV Tab allows you to create and edit WebDAV collections on a virtual server. A WebDAV collection is a resource or a set of resources that are enabled for WebDAV operations. Using WebDAV, you can collaboratively author documents in-place on the Web. WebDAV allows you to place locks of different levels of granularity on WebDAV-enabled resources thus effectively preventing overwrite conflicts during collaborative content authoring on the Web.

The WebDAV tab contains the following pages:

The Add Collection page allows you to create a WebDAV collection.

The Edit DAV Collection page allows you to configure WebDAV-enabled collections.

The Lock Management page allows you to view outstanding locks and other lock-related information pertaining to the WebDAV-enabled resources on your server.

For more information, see Chapter 20, Web Publishing with WebDAV.

Generating Reports for a Virtual Server

You can now generate a report for a single virtual server using the Virtual Server Manager. Create a new access log to be used by the virtual server, and add the new access log to the virtual server settings, as described below.

To generate a report for a virtual server, perform the following steps.

ProcedureTo generate a report for a virtual server

  1. Go to the Logs tab in the Server Manager for the server instance and select Log Preferences.

  2. Create a new access log by entering the path and file name in the Log File field.

    You can also manually create a new access log in magnus.conf by changing

    Init fn=init access="$accesslog" to Init fn=init access="newaccesslog"

  3. Select Only Log under Format and check Virtual Server Id.

    For a custom format, select Custom Format and add %vsid% to the end of the line.

    %vsid% is useful when using multiple virtual servers. This entry records vsid in the access log.

    You can also manually add %vsid% to the end of Init fn in the magnus.conf file.

  4. Click OK.

  5. Click Apply.

  6. Click Apply Changes for your changes to take effect.

  7. Select the virtual server you wish to generate a report for and go to the Virtual Server Manager > Manage Classes > select the Virtual server from the tree view.

  8. Go to the Preferences tab and select Settings.

    In the Access Log field, change the access log to the newly created one.

  9. Click OK.

  10. Click Apply.

  11. Click Apply Changes for your changes to take effect.

  12. Select the Logs tab.

    The Generate Reports page appears.

    This page will not appear unless a virtual server has been created and LogVSid is On. For more information about enabling the Virtual Server Id, see Enabling Logging for a Virtual Server.

  13. (Optional) change the settings, if desired.

  14. Click OK to generate the report.

Choosing a Directory Service for a Virtual Server

You can assign a particular directory service for a particular virtual server. When you do so, the directory service you choose is logged under the USERDB element of the corresponding VS (virtual server) element in the server.xml file. The rights and permissions associated with this directory service is later used by the server to evaluate and enforce access control rules.

To assign a directory service to a virtual server, perform the following steps

ProcedureTo assign a directory service to a virtual server

  1. From the Virtual Server Manager choose the Settings tab.

    A listing of the virtual server settings is displayed.

  2. Click the Edit link next to Directory Services.

    The Pick Directory Services for Virtual Server page is launched in a new window.

  3. Choose a directory service and click OK.

  4. Save and apply changes.


    Note –

    The directory service you choose for a particular virtual server is not shared across other virtual servers. Access control files, on the other hand, are shared across virtual servers.


Deleting a Virtual Server

To delete a virtual server, perform the following steps.

ProcedureTo delete a virtual sever

  1. From the Class Manager, click the Virtual Servers tab.

  2. Click Edit Virtual Servers.

  3. From the drop-down list next to the virtual server you want, choose Delete.

    You cannot delete the default virtual server that was created when you installed the server.

  4. Click OK.

    The virtual server is deleted.