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:
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.
From the Class Manager, choose the Virtual Servers tab.
Click Add Virtual Server.
Choose a name for the virtual server.
Choose a URL host for the virtual server.
You can type more than one URL host, separated by spaces.
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.
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.
Use the following Class Manager pages to edit 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:
From the Class Manager, click the Virtual Servers tab.
Click Edit Virtual Servers.
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.
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.
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.
When you are through editing virtual servers click OK.
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
From the Class Manager, click the Virtual Servers tab.
Click MIME Settings.
Choose a MIME types file from the drop-down list next to the virtual server.
Click OK.
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.
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.
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
From the Class Manager, click the Virtual Servers tab.
Click Quality of Service.
A page appears listing all the virtual servers in the class and their quality of service settings.
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.
Set the maximum bandwidth, in bytes per second, for the virtual server.
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.
Choose the maximum number of connections allowed for the virtual server.
This number is the number of concurrent requests processed.
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.
Click OK.
For more information on the quality of service features, see Using Quality of Service.
To change the location of the virtual server’s access and error logs from the default, follow these steps
From the Class Manager, click the Virtual Servers tab.
Click Logging Settings.
A page appears listing all the virtual servers in the class and the location of their error logs.
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.
If you want to change the paths back to the default, click Default.
Click OK.
To look at the logs for a particular virtual server, follow these steps:
From the Virtual Server Manager choose the Logs tab.
Click View Access Log or View Error Log.
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.
Click OK.
To enable virtual server level logging, perform the following steps
Go to the Logs tab in the Server Manager for the server instance and select Log Preferences.
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"
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.
Click OK.
Click Apply.
Click Apply Changes for your changes to take effect.
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 SP10 Administrator’s Configuration File Reference.
The Virtual Server Manager contains four tabs: Preferences, Logs, Web Applications, and WebDAV.
The Preferences tab contains pages for:
Status
Settings
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:
State (on or off)
Document root
Access and error log directories
Directory services
ACL file
MIME types file
CGI settings
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
The Edit DAV Collection Page
The Lock Management Page
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.
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.
Go to the Logs tab in the Server Manager for the server instance and select Log Preferences.
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"
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.
Click OK.
Click Apply.
Click Apply Changes for your changes to take effect.
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.
Go to the Preferences tab and select Settings.
In the Access Log field, change the access log to the newly created one.
Click OK.
Click Apply.
Click Apply Changes for your changes to take effect.
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.
(Optional) change the settings, if desired.
Click OK to generate the report.
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
From the Virtual Server Manager choose the Settings tab.
A listing of the virtual server settings is displayed.
Click the Edit link next to Directory Services.
The Pick Directory Services for Virtual Server page is launched in a new window.
Choose a directory service and click OK.
Save and apply changes.
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.
To delete a virtual server, perform the following steps.