Creating Multiple Adaptors and Virtual Hosts


Creating Multiple Adaptors and Virtual Hosts

Creating multiple adaptors and virtual hosts is quite simple, but it does involve some manual handling of files and folders. It also requires server restarts, so do not perform these steps on any "live" production servers. In Exercise 14.1, you will create a new adaptor within your Flash Communication Server. This new adaptor will have two virtual hosts, each with their own set of users, which you will work with in Exercise 14.2. This simple scenario can be used if you are planning an application that has multiple developers on it or applications that must be kept totally separate.

You will primarily be working in the file system of your server and within Dreamweaver MX; however, a simple text editor such as Windows Notepad will do. We will use a Developer install of the Flash Communication Server.

There will be references to two sets of folders and files throughout this exercise. To help you out, here is where to find the folders used:

  • Flash Communication Server Install Folder: C:\Program Files\Macromedia\Flash Communication Server MX\

  • FCS Default Application Folder: C:\inetput\ wwwroot \FlashCom\

Note

Exercises 14.1 and 14.2 require the Professional version of Macromedia Flash Communication Server MX. The trial version of the Flash Communication Server is the Professional version. To determine if you have the correct version, log into the Administration Console, and click the License tab.

If you own the Personal version of the Flash Communication Server, or are using a shared hosting facility, then you will not be able to run these exercises. You should read through them to understand how the server operates and to acquire a better understanding of using some of the XML configuration files.


Exercise 14.1: Creating a New Adaptor

You have decided to create a new adaptor because you need to bind it to a new specific IP address and port number and may want to only allow certain IP address to access it.

  1. Browse to your Install folder.

  2. Open the configuration folder, conf. This folder contains all adaptors and configuration files for the server and the adaptors.

  3. Select the folder, _defaultRoot_; this is the default adaptor that was installed on your system. The _defaultRoot_ folder is a good "template" for additional adaptors. So let's copy it.

  4. Select the _defaultRoot_ folder and choose Edit, Copy from the Windows Explorer menu.

  5. Paste a new copy of the _defaultRoot_ folder in the conf folder.

  6. Rename the new folder to myAdaptor. This will be the name of your adaptor.

    Doing this simple copy and paste is usually your best method for creating a new adaptor. If your plan includes creating multiple adaptors, then you might consider creating a template adaptorone that you can set up to easily duplicate. If you are creating the adaptor manually, you must ensure that each new adaptor has the adaptor.xml file. There must also be at least one default virtual host, called _defaultVHost_, which contains the Vhost.xml and the Application.xml configuration files. Explore the new adaptor and you will see these files and folders exist.

    Next , you must register this new adaptor with the server. You do this by editing the Server.xml file. You should be familiar with XML structures before editing this file, as it may have detrimental effects on your server.

  7. Open the Server.xml configuration file located in the conf folder.

  8. Locate the closing </Adaptor> tag (line 65). The next few lines of XML will be inserted between this tag and the </Admin> tag immediately below.

  9. Declare the new adaptor by assigning it the name of the folder you just created.

     <Adaptor name="myAdaptor"> 
  10. Add the default virtual host reference:

     <VirtualHost name="_defaultVHost_">      <UserList>         <User name="">             <Password encrypt="false"></Password>             <Allow></Allow>             <Deny></Deny>             <Order>Deny,Allow</Order>         </User>     </UserList> </VirtualHost> 

    You will get into the details of this shortly, when you create some new virtual adaptors.

  11. Close the <Adaptor> tag:

     </Adaptor> 
  12. Save the Server.xml file. Leave it open, if you like; we will be returning to it shortly.

    That's it for registering the adaptor with the server. You will be editing this again when virtual hosts are added. Now you can assign the adaptor a unique IP address and port number in its configuration file, Adaptor.xml.

    Before opening the configuration file, the IP addresses you are using must be registered to your server before restarting the Flash

    Communication Server. Be sure to use IP addresses assigned to you by your system administrator. Assigning an IP address that is assigned to another computer will have adverse affects for both your computer and the other computer using that address.

    Tip

    To add IP addresses in Windows, open the TCP/IP setting for your network adaptor on the server. This can be found in the Network and Dial-up Connections item in the Windows control panel. Usually, if you have a single network card in your server, it will be called Local Area Connection. Open its properties; double-click the TCP/IP protocol to edit the properties. Click the Advanced button. Click the Add button, and enter a new IP address and subnet mask (see Figure 14.3).

    Figure 14.3. Windows 2000 TCP/IP Settings allow you to assign multiple IP addresses to a single network card.

    graphics/14fig03.gif

    You will not be able to do this if your server is set up to receive its IP address dynamically from a DHCP sever. You will need to assign a static IP address (provided by your network administrator) before you can continue.

  13. Open the file Adaptor.xml in the myAdaptor folder.

  14. Find the line that contains <HostPort>:1935</HostPort> . This line defines what IP address and what port this adaptor will be referenced by. You cannot have two adaptors communicating on the same port and the same IP address. You can enter any number of IP addresses between the <HostPort> tags, separated by a comma. If you omit the port number, Flash Communication Server will automatically use port 1935. You can even assign this adaptor to multiple ports by entering a value of :1935,80,8080.

  15. Enter the new IP addresses and ports to bind this adaptor to in-between the <HostPort> tags.

  16. Save the Adaptor.xml file, and close it.

Note

You should also assign a static IP address for the _defaultRoot_ adaptor, to ensure that it communicates on a specific IP address. You can do this by editing its Adaptor.xml file located in the _defaultRoot_ folder.


The adaptor will not be registered until you restart the Flash Communication Server. You can restart the server a number of ways, but the easiest is by using the Windows Start menu item: Click Start, Programs, Flash Communication Server MX, Stop Service, and, after it has finished, select Start Service in the same program menu.

Exercise 14.2: Creating a New Virtual Host and Users

With the new adaptor in place, let's create a virtual host and some unique users so they can access the App Inspector. This is done within the adaptor in the conf folder.

  1. Browse to the folder myAdaptor in the conf folder.

  2. Copy the folder _defaultVHost_, and paste the copy in the myAdaptor folder.

  3. Rename the copy to MyNewHost

    You've just created the new virtual host; compare your folder structure to Figure 14.4. The server uses this folder to configure itself only. It will not be used to store applications. Applications can be placed anywhere on the server you like. In the next steps you will register the new virtual host with the adaptor and declare where it will find the applications.

    Figure 14.4. The complete conf directory tree containing a new adaptor with two virtual hosts.

    graphics/14fig04.gif

  4. Open the Server.xml file in the conf folder, and locate the </Adaptor> tag that closes the myAdaptor reference. It should be just above the </Admin> tag. You will place the next series of XML tags just above the </Adaptor> tag.

  5. Adding a new XML VirtualHost structure will declare the new virtual host on the adaptor. Simply copy the default <VirtualHost> structure and paste it below the default reference.

  6. Declare the new virtual host, and remember, it's case sensitive:

     <VirtualHost name="myNewHost"> 
  7. Define an empty UserList structure. You can manually declare users by duplicating this structure, one per user, or use the Administration Console to manage it for you. We will use the Administration Console. Users defined in this list will have limited access to the Administration Console. Use the code:

     <UserList>      <User name="">         <Password encrypt="false"></Password>         <Allow></Allow>         <Deny></Deny>         <Order>Deny,Allow</Order>     </User> </UserList> 
  8. Close the VirtualHost structure:

     </VirtualHost> 
  9. Save the Server.xml file.

    The new virtual host will not be defined until you restart the Flash Communication Server. But don't get too far ahead yet; you haven't declared where the applications for this host will be stored. If you are an ISP, a virtual host for each user would be created for each user of the system. Their applications folder could be assigned to their account folder on the server. The applications folder is where users save their ASC files, and where video (FLV) and SharedObject (FSO) files are stored. A drive with enough disk space for these applications should be chosen .

    The example host will be used as a production server, so the applications folders are not accessible through the web server. For security reasons, we will place the applications in a new folder on a large disk array mapped as drive D.

  10. Create a folder called myNewHost_apps on the root of your D drive (or anywhere in your file system).

  11. Create a folder for the Administration Console application. Place a new folder called admin within the myNewHost_apps folder.

  12. Now, register the application folder with your new virtual host, back in the conf folder.

  13. Open the file Vhost.xml in the myNewHost folder.

  14. Locate the <AppsDir> tag. This tag defines where the applications are located for this virtual host. Enter the absolute path to the applications folder. For this exercise, use the following path :

     <AppsDir>d:\myNewHost_apps</AppsDir> 
  15. Save and close the Vhost.xml file.

  16. Restart Flash Communication Server MX.

When the server restarts, log into the Administration Console using your normal system login and password. Click on the Administration Users tab, and you should see a visual representation of the new adaptor and the new virtual hosts (Figure 14.5).

Figure 14.5. The Administration Users tab within the Administration Console allows you to manage virtual host users within a simple GUI.

graphics/14fig05.gif

Within the Administration Users panel you can add users to your server or to virtual hosts. Virtual host users will have access to applications within their virtual host only. They will not be able to reboot the server, but they will have access to restart their virtual host. This is a great technique to offer Flash Communication Server as a service with multiple users.

Giving Your Users Access

With your adaptors and virtual hosts set up, you can now give your users their logins and passwords for the App Inspector. If you decide to use only the default adaptor, your users can log into the App Inspector by simply entering their username and password. If you choose to use a different adaptor, then they will have to add the name of the adaptor to which their login is assigned in the username field. Figure 14.6 illustrates a login to a virtual host attached to the adaptor myAdaptor.

Figure 14.6. To log into the App Inspector using the nondefault adaptor, place the adaptor name in front of the username.

graphics/14fig06.gif



Macromedia Flash Communication Server MX
Macromedia Flash Communication Server MX
ISBN: 0735713332
EAN: 2147483647
Year: 2002
Pages: 200
Authors: Kevin Towes

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net