Configuring Flash Communication Server > About the configuration files > The Vhost.xml file

 

The Vhost.xml file

The Vhost.xml file configures a virtual host within an adaptor. Each virtual host must have its own directory inside the adaptor directory.

The name of the directory must be the actual name of the virtual host, such as streaming.macromedia.com. Each virtual host you define must map to a DNS entry, or another name resolution such as a WINS address or a hosts file, that specifies an IP address on the server computer.

Each adaptor must contain a _defaultVHost_ directory in addition to the custom virtual hosts that you define. If a client application tries to connect to a virtual host that does not exist, the server attempts to connect it to _defaultVHost_.

Each virtual host directory contains a Vhost.xml file. This file contains tags that define the settings for the virtual host. These settings include aliases for the virtual host, the location of the virtual host's application directory, limits on the resources the virtual host can use and other parameters.

The Vhost.xml file contains the following tag structure, with brief comments for each tag:

<VirtualHost>
	<AliasList>
		<Alias name="acme">acme.myDomain.com</Alias>
	</AliasList>
	<AppsDir>C:\Program Files\Macromedia\Flash Communication Server MX\applications\</AppsDir> 
	<RecordAccessLog>true</RecordAccessLog> 
	<ResourceLimits>
		<MaxConnections>-1</MaxConnections> 
		<MaxAppInstances>-1</MaxAppInstances> 
		<MaxStreams>-1</MaxStreams> 
		<MaxSharedObjects>-1</MaxSharedObjects>
		<AppInstanceGC>20</AppInstanceGC>
	</ResourceLimits>
	<VirtualDirectory>
		<Streams></Streams> 
	</VirtualDirectory>
	<DNSSuffix></DNSSuffix>
	<Allow>all</Allow>
</VirtualHost>

The tags in the Vhost.xml file are described below. You can change the values of some of these tags at runtime; to learn how, see the administration API article at Macromedia's website.

<VirtualHost> is the root tag for the XML document. It is a container for all the other tags.

<AliasList> is a container for one or more <Alias> tags.

<Alias> allows you to specify an alternative short name to use when connecting to the virtual host. You can use this tag to shorten long host names. You can specify an unlimited number of aliases by adding additional <Alias> tags. Each alias you specify must be mapped to the correct IP address for the virtual host.

For example, if the host name is machineName.company.com, then you could use the name attribute of the alias tag to shorten the host name to machineName:

<Alias name = "machineName">machineName.company.com</Alias>

Do not use the same alias for more than one virtual host. If more than one virtual host on the same adaptor has the same alias defined, then the first match found will be used by the server. This can cause unpredictable results.

<AppsDir> specifies the path to the applications for this virtual host; during installation, the default location is written to the default Vhost.xml file. In Windows, the default <AppsDir> location is C:\Program Files\Macromedia\Flash Communication Server\applications. On UNIX, the default location is /opt/macromedia/fcs/applications.

If nothing is specified in this tag, it defaults to C:\Program Files\Macromedia\Flash Communication Server MX\conf\_defaultRoot_\_defaultVHost_\ in Windows. On UNIX, the default <AppsDir> path is /opt/macromedia/fcs/conf/_defaultRoot_/_defaultVhost_/.

This tag allows you to change the location of your applications directory and server-side script files, if you wish. For example, if you want to keep your application subdirectories and server-side script files in C:\Financial_Apps, you can specify that path in the <AppsDir> tag. You would create subdirectories named with your application names in C:\Financial_Apps to register your applications with the server.

You can also specify multiple applications directories by separating locations with a semicolon (;). For example, you could specify the following two locations, each of which contained application subdirectories: <AppsDir>C:\MyApps;D:\NewApps</AppsDir>.

If you change the default location of <AppsDir>, be sure to include a directory named admin in each directory. This ensures that the Administration Console (admin.swf) will be able to connect to the virtual host. For more information, see Using the Administration Console.

<RecordAccessLog> indicates whether the server should (true) or should not (false) record connections to the server. This information is written to an access.flv file in the virtual host's admin\Streams\Logs\ directory inside its application directory.

<ResourceLimits> is a container tag for the next five tags. By specifying values for these five tags, you can ensure that the server does not consume excessive resources for the virtual host, and you can prevent denial of service attacks to the server.

<MaxConnections> specifies the maximum number of simultaneous connections allowed on this virtual host. Connections are denied if the specified limit is exceeded. The default of -1 allows an infinite number of connections. If you supply a different value, it must be a positive integer. If you specify a negative or non-numeric value, the default is used. This value can be changed at runtime.

<MaxAppInstances> specifies the maximum number of application instances that can be loaded by this virtual host. (A chat application, for example, might require more than one instance, because each chat room would be represented by a separate instance of the application on the server.) A Flash movie defines which application instance it is connecting to by the parameters it includes with its ActionScript connect call.

The default value of -1 allows an infinite number of application instances. If you specify a different value, it must be a positive integer. This value can be changed at runtime.

<MaxStreams> specifies the maximum number of streams that the virtual host can create. The default value of -1 allows an infinite number of streams. If you supply a different value, it must be a positive integer. This value can be changed at runtime.

<MaxSharedObjects> specifies the maximum number of shared objects that the virtual host can create. (For more information about shared objects, see Developing Communication Applications Help.) The default value of -1 allows an infinite number of streams. If you supply a different value, it must be a positive integer. This value can be changed at runtime.

<AppInstanceGC> specifies, in minutes, how often to collect and dispose of application instance resources: shared objects, streams, and script engines. The default value is 20 minutes; the minimum value is 5 minutes.

Garbage collection is processor-intensive. To keep memory as free of unused objects as possible, set this value to a shorter interval. To avoid a brief decrease in performance during garbage collection, set it to a longer interval. This value can be changed at runtime.

<VirtualDirectory> is a container for one or more <Streams> tags that specify virtual directories for shared stream resources.

<Streams> allows you to specify a virtual directory for storing stream resources used by more than one application. By using a virtual directory, you can specify a relative path that points to a shared directory used by multiple applications. The contents of this tag must be in the form virtualDirectory;actualDirectory.

For example, suppose you specify the following:

<Streams>common;C:\FlashComServer\myApplications\shared\resources\</Streams> 

In this case, any application that refers to a stream whose path begins with common\ will access the item in C:\FlashComServer\myApplications\shared\resources\ regardless of the application's own directory structure. Therefore, if the application VideoConference refers to the item common\video\recorded\June5 and the application Collaboration refers to common\video\recorded\June5, they both actually refer to the item C:\FlashComServer\myApplications\shared\resources\video\recorded\June5.

If the virtual directory you specify does not end with a backslash, one is added by the server.

You can specify more than one virtual directory mapping by adding multiple <Streams> tags.

<DNSSuffix> allows you to specify a primary DNS suffix for this virtual host, such as myCompany.com or myUniversity.edu. If a reverse DNS lookup fails to return the domain as part of the host name, this tag is used as the domain suffix.

The <Allow> tag lets you specify domain names from which client applications should be allowed to connect to this virtual host. The default value is all, which allows connections from any domain. If no value is specified, only connections from the domain that is being connected to are allowed. If you list specific domains in this tag, only connections from those domains are allowed. Separate each domain name in the list with a comma.

The following set of Vhost.xml tags has been customized for real-world use. The alias acme is defined for the virtual host. The application directory is set to C:\Inetpub\wwwroot\apps\. The maximum number of simultaneous connections is set to 50. The virtual directory for streams is set to \streamTemp. The domain suffix is set to macromedia.com for reverse DNS lookups. Finally, the virtual host will accept connections from any IP address.

<VirtualHost>
	<AliasList>
		<Alias name="acme">acme.myDomain.com</Alias>
	</AliasList>
	<AppsDir>C:\Program Files\Macromedia\Flash Communication Server MX\applications\</AppsDir> 
	<RecordAccessLog>true</RecordAccessLog> 
	<ResourceLimits>
		<MaxConnections>50</MaxConnections> 
		<MaxAppInstances>-1</MaxAppInstances> 
		<MaxStreams>-1</MaxStreams> 
		<MaxSharedObjects>-1</MaxSharedObjects> 
		<AppInstanceGC>20</AppInstanceGC>
	</ResourceLimits>
	<VirtualDirectory>
		<Streams>streamTemp;C:\sharedstreams</Streams> 
	</VirtualDirectory>
	<DNSSuffix>macromedia.com</DNSSuffix>
	<Allow>all</Allow>
</VirtualHost>