Skip navigation.
Downloads | Product Documentation | Support

Administration Console Online Help

# Virtual Hosts

[Attributes and Console Screen Reference for Virtual Hosts]

Virtual hosting allows you to define host names to which servers or clusters respond. When you use virtual hosting you use DNS naming to specify one or more host names that map to the IP address of a WebLogic Server or cluster and you specify which Web Applications are served by each virtual host.

Virtual Hosts are instances of a web server that have been given specific DNS names in order to facilitate routing requests from clients to the correct web server. Virtual Hosts prevent the client from discovering the IP address of the web server inadvertently by placing the DNS name into the header of the request rather than the IP address of the machine on which the web server is deployed..

Virtual Hosting is used in order to direct client requests to specific web servers using DNS names to differentiate between servers which may be found at the same IP address.

# Tasks

## Configuring a VirtualHost

1. Click the VirtualHost node. The VirtualHosts table displays in the right pane showing all the VirtualHosts defined in your domain.
2. Click the Configure a New VirtualHost text link. A dialog displays in the right pane showing the tabs associated with configuring a new VirtualHost.
3. Enter values in the Name and Virtual Host Names attribute fields.
4. Click Create to create a web-server instance with the name you specified in the Name field. The new instance is added under the VirtualHost node in the left pane.
5. Click the Logging tab to set up logging of HTTP requests. For more information, refer to Specifying HTTP Log File Settings for a Virtual Host. Click Apply to save your changes.
6. Click the HTTP tab and change the attribute fields or accept the default values as assigned. Click Apply to save your changes.
7. Restart the server for the Virtual Host to take effect.

## Cloning a VirtualHost

1. Click the VirtualHost node. The VirtualHosts table displays in the right pane showing all the VirtualHosts defined in your domain.
2. Click the Clone icon in the row of the VirtualHost you want to clone. The configuration dialog displays in the right pane showing the tabs associated with cloning a VirtualHost.
3. Enter values in the Name and Virtual Host Names attribute fields.
4. Click Create to create a web-server instance with the name you specified in the Name field. The new instance is added under the VirtualHost node in the left pane.
5. Click the Logging tab to set up logging of HTTP requests. For more information, refer to Specifying HTTP Log File Settings for a Virtual Host. Click Apply to save your changes.
6. Click the HTTP tab and change the attribute fields or accept the default values as assigned. Click Apply to save your changes.

## Specifying HTTP Log File Settings for a Virtual Host

1. Click the VirtualHost node. The VirtualHosts table displays in the right pane showing all the VirtualHosts defined in your domain.
2. Click a VirtualHost.
3. On the Logging tab, click Enable Logging to activate or deactivate HTTP logging. (If Enable Logging is checked, the HTTP logging will be activated.)

HTTP requests for a virtual host are kept in a log file that is separate from the server's log files.

4. Determine the format of the HTTP log file by selecting Common or Extended from the Format list.
5. To determine the frequency with which the server empties the virtual host's HTTP-request buffer and writes the data to the HTTP log file, do the following:

1. In Log File Buffer KBytes, specify the maximum size (in kilobytes) of the HTTP-request buffer.
2. In the Log File Flush Secs parameter, specify the interval (in seconds) at which the server checks the size of the HTTP-request buffer. If the buffer has reached the maximum size, the server writes the data to the HTTP log file.

6. If you want the server to move old HTTP requests to another file when the current HTTP log file reaches a specific size, do the following:

1. In Log Rotation Type, choose `By Size`.
2. In Max Log File Size KBytes, specifiy the file size (1 - 65535 kilobytes) that triggers the server to move log messages to a separate file. After the log file reaches the specified size, the next time the server checks the file size, it will rename the current log file and create a new one to store subsequent messages.
3. Click Apply.

7. If you want the server to move old HTTP requests to another file at specific time intervals, do the following:

1. In Rotation Type, choose `By Time`.
2. In Log Rotation Time Begin, enter the start time.

At the time that you specify, the server rotates the current log file. If the time that you specify has already past, then the server starts its file rotation immediately. Thereafter, the server rotates the log file at an interval that you specify in Log Rotation Period Mins.

Use the following `java.text.SimpleDateFormat` format to specify a date and time: `MM-dd-yyyy-k:mm:ss`. For information about this format, refer to the J2EE Javadoc.

3. In Log Rotation Period Mins, enter the interval (in minutes) at which the server saves old messages to another file.
4. Click Apply.

8. To include a time or date stamp in the file name when the log file is rotated, in the File Name field, add `java.text.SimpleDateFormat` variables to the file name. Surround each variable with percentage (`%`) characters.

For example, if you enter the following value in the File Name field:
`access_%yyyy%_%MM%_%dd%_%hh%_%mm%.log`

the virtual host's HTTP log file will be named:
`access_yyyy_MM_dd_hh_mm.log`

When the server instance rotates the HTTP log file, the rotated file name contains the date stamp. For example, if the server instance rotates the log file on 2 April, 2003 at 10:05 AM, the log file that contains the old log messages will be named:
`access_2003_04_02_10_05.log`

If you do not include a time and date stamp, the rotated log files are numbered in order of creation `filename` `nnnn`, where `filename` is the name configured for the log file. For example: `access.log0007`.

## Deleting a VirtualHost

1. Click the VirtualHost node. The VirtualHosts table displays in the right pane showing all the VirtualHosts defined in your domain.
2. Click the Delete icon in the row of the VirtualHost you want to delete. A dialog displays in the right pane asking you to confirm your deletion request.
3. Click Yes to delete the VirtualHost. The web-server icon under the VirtualHost node is deleted.

## Assigning a VirtualHost

1. Click the instance node in the left pane for the VirtualHost you want to assign. A dialog displays in the right pane showing the tabs associated with this instance.
2. Click the Targetand Deploy tab.
3. Complete the following steps:

1. Select one or more targets that you want to assign to the VirtualHost.
2. Click Apply to save your assignments.

## Targeting Web Applications to the Virtual Host.

1. Click the Web Applications node in the left panel.
2. Select the Web Application you want to target.
3. Click the Targets tab in the right panel.
4. Select the Virtual Host(s) to which you wish to target the Web Application.
5. Click Apply.