Warning

This document hasn't been checked for compatibility with current versions of Plone. Use at your own risk.

Proxy Definitions: Using a GUI tool to manage virtual hosts and load balancing

by Robert Nagle last modified May 17, 2009 10:00 AM
Enfold Proxy uses "proxy definitions" to manage multiple virtual IIS hosts and load balancing of multiple Zope clients

In many respects, setting up virtual hosts is the same in Apache and IIS, except that in IIS you use a series of dialog boxes instead of a configuration file.

IIS 6 version (and above) let you set up multiple IIS servers. As a general practice, you should create a new IIS web server for each Internet host you use. For example, if you wish  to host two separate Internet hosts (i.e., www.myplonesite.com and backupplone.mysite.com), you should set up 2 separate IIS web servers.  You do this by selecting New Server on the right click menu.  

Creating a new IIS Site

Next you configure the host headers on each IIS web server to correspond to the Internet host you want for your website.

 

The next step is to launch  the Enfold Proxy control panel. (Since Enfold Proxy operates whenever  IIS is running, you do not actually need to start it--you merely need to launch the control panel).

Before you create a proxy definition in Enfold Proxy, you should confirm three things. 

  1. Configure your first IIS host (that's what you just did). 
  2. Verify that your IIS host resolves correctly. If you type www.originalfunsite.com  , does IIS show a default page? (Read more about resolving IIS hosts).
  3. Make sure that your Plone site is running by checking its management port.  (i.e., try http://localhost:8080 , http://localhost:8080 or http://localhost:8080/Plone ; do you see something?)

 


Creating  a proxy definition

 
A proxy definition is a set of instructions specific about how Enfold Proxy should proxy (or redirect or cache) http requests from one IIS host. Generally, with one important exception, you declare your hosts in IIS and use "proxy definitions" to connect these hosts with Plone sites on Enfold Server.

Enfold Proxy originally arose out of the need to simplify the URL mapping process within Plone in a Windows environment. However, because Enfold Proxy is essentially a plugin for IIS (it is an ISAPI filter for IIS), you can use proxy definitions to wrap a non-Plone site into a Plone site and vice-versa. That makes it easy to integrate a java application or Django application together with a Plone site together under the same domain.

For instance you could use EP to set up these mappings:

    • www.funsite1.com (and recursive URL web directories) could be used to serve Plone content.
    • www.funsite1.com/payroll could be used to serve a java servlet you added inside IIS.
    • www.funsite1.com/media/ could be used to serve videos (from a media server you added to IIS).

When should you NOT create a proxy definition? Exactly one proxy definition should correspond to one IIS site. You should not need a second proxy definition to point to the same IIS site (unless you're running IIS 5).

 

Basic Steps

  1. Make sure your  Zope client(s) are running, and that the management port is accessible (i.e., type www.myfunsite.com:8080/plone in the browser). 
  2. Open the Enfold Proxy control panel.  (Start --> Enfold Proxy  --> Enfold Proxy)
  3. Click the folder on the left panel Proxy.
  4. Choose Add a Proxy Definition.  Give your proxy definition any name you want.

  5.   Adjust the basic settings if necessary. By default, the new host comes with the most common defaults:

     

    Local host= /
    Virtual host root = /Plone

    The setting above  will cause the root (/) of your URL to go to the Plone site automatically created within your Zope client. The Plone site object should be visible inside the Zope Management Interface (ZMI). Change these values when necessary. You can verify the value for Virtual host root by logging into the ZMI application root and verifying that a folder corresponds to this value already exists. For more, see Adding a Plone site with the ZMI.

  6. Add the Virtual Host that corresponds to your management port of your Zope client. The virtual host can be an IP address or a resolvable host. Examples: 127.0.0.1:8080, 192.168.1.150:8080, localhost:8080

    Proxy virtual host settings

  7. In your Proxy Definition, select the Site tab on the top. When you come to that screen, you will see a dropdown screen for the Site screen. Choose the IIS site which is serving the host/domain you will be using. For this, we shall use Default Web Site (which uses the www.originalfunsite.com host headers) The initial site created by IIS is called Default Web site, but  in IIS you can give a website any name you want).

  8. After you press save for the last time, you will be able to see a "virtual folder" appear under the IIS which this proxy definition will be matched with. This virtual folder will be called _plone by default.

    Note: This proxy definition you created or edited in Enfold Proxy will not take effect until you see the _plone folder in your IIS website. EP will automatically make sure this virtual folder exists in the IIS whenever you save or update your Proxy Definition. If you do not see the folder which says _plone, try one or all of the options listed below:

            * refresh the web site by typing F5 or using the Refresh icon the toolbar (in most cases this is sufficient).
            * restart the specific IIS site
            * restart the IIS server entirely.
            * make a minor edit to the proxy definition and press Save again (you can undo this later).

    To host multiple sites, you would create another IIS site, and then create a separate IIS proxy definition and link them (as mentioned above).


Load Balancing with Enfold Proxy

Note: Load balancing assumes that all Zope clients are connected to the same Zope object database (ZODB).

After you create a proxy definition for your host, you can add load-balancing clients with one step: add another entry in the Virtual host field. This Virtual host field is located on the Basic tab of your proxy definition. Add multiple entries if you wish to load balance multiple Zope clients.

Here are examples of Virtual Hosts to include in your proxy definition (on the Basic tab). All formats listed here are acceptable:

localhost:8080
localhost:8090
192.168.1.150:8080
192.168.1.151:8080
www.originalfunsite.com:8080

Notes:

  1. In most cases, these URLs will be a Zope client. They can be running from Linux boxes or Windows boxes (from Enfold Proxy's standpoint, it doesn't matter).
  2. Omit the http:// prefix. Always include the port number.
  3. The Virtual Host can be on the same machine or (more commonly) on different machine(s).
  4. You can use IP addresses and/or host names.
  5. Load balancing will not work unless you have 2 or more Virtual hosts listed here.
  6. Each entry must be a URL for a unique host. One host should not simply be an alias for another.  

After you push save, load balancing should work immediately.

To remove a client from load balancing, delete the appropriate line in the Virtual Host field.

Even though load balancing provides a kind of insurance policy against failures, you still need a monitoring tool like Big Brother to make sure individual machines are online. A load-balanced cluster might have four virtual hosts/Zope clients and still work if three of them go offline. But if you are never notified about this occurrence, you would be at risk if the fourth goes offline also.

Customizing Load Balancing

When you go to a proxy definition in your GUI, there will be  a tab for load balancing with settings  you can change.  For example, you choose to use round robin, random, or least connections as the method to determine which Zope client will handle the requests. These changes take effect when you press Save.


Contribute

Something wrong or out of date? Anybody can edit or create a new article in the knowledge base. Simply create an account on this site, log in, and click the Edit button to contribute.