Although Zope is a full-featured application server, you might be able to use Plone in an enterprise environment only if it utilizes your company's standard set of applications, such as Microsoft IIS or Apache as a web server, or a different relational database server. In the next sections, you'll learn some methods for integrating these technologies.
Zope Virtual Hosts
If you want Apache or Microsoft IIS to serve your Plone pages, the first thing you need to do is create a virtual host object inside the folder that you want to serve via the alternate web server. Zope virtual hosts are added and controlled through a Virtual Host Monster, which is added through the Zope Management Interface. Despite its name , the Virtual Host Monster (VHM) is not a big scary thing; it simply changes the URLs generated by your Zope/Plone objects.
To install a VHM, log in as the manager to the Zope Management Interface at http:// yourdomai n:8080/manage and click on the Root Folder link so that the contents of the root folder are in the workspace frame. From the pull-down menu, select Virtual Host Monster and press the Add button.
Enter the ID for the VHM. In this case, I used myPloneVHM. Then press the Add button. The VHM is added to your Zope application server; the remaining configuration occurs within the alternate web server, which you'll learn about in a moment. When the VHM is added in the root folder of your Zope server, you do not need to add other VHMs. If you refresh the contents of the root folder and click on the VHM object you just added, you will see a page full of information regarding the inner workings of the VHM, with the primary point being "one is enough." Next, move on to making the appropriate modifications to either Apache or Microsoft IIS.
Figure 8.7. Adding a Virtual Host Monster.
Running Plone with Apache
This section discusses how to run Plone with Apache as the core web server. This section assumes that you already have a working version of Apache (either version 1.3. x or 2.0. x ) configured and happily running on your system; the instructions detail the changes that must occur to Apache, Zope, and Plone.
If you haven't already done so, visit http://httpd.apache.org/ to download Apache. Then follow the instructions included with the Apache distribution to successfully install Apache on your system. Configuration instructions are provided next for both Apache versions 1.3. x and 2.0. x .
If Apache is already your primary web server, it is likely already listening on port 80. However, if you're just getting into the game and are installing Apache after Zope and Plone have been running, you'll need to modify the port on which Plone is running to some unused port such as 81. Zope can still run on port 8080; in fact, you want to keep your Zope configuration just so.
The goal is to have Apache act as a proxy for your Plone site so that you can access http:// yourdomain / and have that be your Plone site ”none of this http:// yourdomain /myPlone sort of URL. To achieve this goal, Apache must act as a proxy for Plone, which occurs through the activation of the mod_proxy Apache module, and the Zope application server needs to know that a virtual host is in the mix.
Apache Configuration Modifications
With your Zope Virtual Host Monster in place, the second piece of the puzzle is to configure Apache. Configuring Apache to act as a proxy or to rewrite requests requires the addition of a virtual host directive to the Apache httpd.conf configuration file. First, however, you might want to think about one security- related element.
If you are creating a proxy, you have the option of limiting access to it at the server level; this is a good idea if you want to limit access to your Plone site to people within your corporate network, for example. Although your site will retain all of its user account-related security, if you don't want anonymous visitors who are truly anonymous ”those who are not even part of your company ”you'll want to restrict even the sheer appearance of your site from the outside world. To do so, add the following directive in httpd.conf , replacing 191.111.0 with your own netblock:
<Proxy *> Order Deny,Allow Deny from all Allow from 191.111.0 </Proxy>
If you are not the system administrator for the Plone server, or if you are unaware of your netblock, ask your system administrator or hosting provider before continuing.
After modifying the httpd.conf file, the next step is to create the virtual host directive; the instructions are slightly different, depending on whether you are using Apache version 1.3. x or 2.0. x .
If you are using Apache 1.3. x and did not install mod_proxy when you originally installed Apache by specifying the --enable-module=proxy and --enable-module=proxy_http configuration flag on Linux/Unix or uncommenting the appropriate modules in the httpd.conf configuration file on Windows, do so before continuing. Similarly, Apache 2.0. x users need to have mod_rewrite activated.
In the instructions that follow, substitute the following with your own values:
yourdomain ” Use your own domain name, such as company.com or mysite.net.
yourPlone ” Use the name of the Plone folder on your Zope server.
For Apache 2.0. x users, the following virtual host directive is appropriate:
<VirtualHost *:80> ServerName yourdomain ServerAlias yourdomain ServerSignature On <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^/(.*) \ http://localhost:8080/VirtualHostBase/http/yourdomain:80/yourPlone/VirtualHostRoot/[L,P] </IfModule> </VirtualHost>
Apache 1.3. x users should use the following virtual host directive:
<VirtualHost *:80> ServerName yourdomain ServerAlias yourdomain ServerSignature On ProxyPass / \ http://localhost:8080/VirtualHostBase/http/yourdomain:80/yourPlone/VirtualHostRoot/ ProxyPassReverse / \ http://localhost:8080/VirtualHostBase/http/yourdomain:80/yourPlone/VirtualHostRoot/ </VirtualHost>
Although they are written differently and use different modules, both virtual host entries achieve the same goal: to take a request from your domain (port 80) and find the appropriate matching elements on your domain, port 8080 ”the Zope instance. To see this in action, simply make the configuration changes and restart Apache. When you type the URL to access your Plone site, you no longer have to type http://yourdomain/yourPloneSite ; you type only http://yourdomain/ .
Running Plone with Microsoft IIS
This section discusses how to run Plone through Microsoft IIS instead of the Zope web server. This section assumes that you already have a working version of Microsoft IIS on your system. The common method for implementing Plone with Microsoft IIS comes in the form of an ASP script found at http://www.zope.org/Members/hiperlogica/ASP404. According to the authors, when it is implemented, this script forwards requests to the Zope server and relies on the Zope Virtual Host Monster to send back the correct URLs.
To get started, download the ASP404 script from the URL referenced previously, and open the file in a text editor so that you can set some configuration variables . Only a few are necessary, but the authors have written a plethora of instructions in their code so that you have the information necessary to make additional modifications, if you want.
You must enter these primary configuration variables:
zopeAddress ” The location of your Zope server, such as http://yourdomain:8080 . Do not use a trailing slash, and do not use folder names .
zopePath ” The folder that you want to serve via Microsoft IIS, such as /yourPlone . Again, do not use a trailing slash.
Next, place your modified file in your IIS folder, such as C:\Inetpub\ wwwroot , and open the Internet Services Manager. From the Internet Services Manager, right-click on the folder that you want to serve from, such as Default Web Site, and then choose the Properties tab. Access the Custom Errors tab and look for the entry for 404. You will modify the properties of how 404 errors are handled, so click Edit Properties and select URL from the Message Type drop-down list. In the URL field, enter /default.asp , the name and location of the script you just configured. Repeat the process to assign /default.asp to the 405 error, and then restart IIS.
Depending on the configuration of IIS, you might have to modify the order of your default documents if default.asp is not the primary default document. To change the precedence, open the Internet Services Manager and click on the folder for the Default Web Site (or a specific site). Then click Properties, followed by the Documents tab. Use the Move Up or Move Down buttons to change the order of existing documents, or use the Add button to create a new default document. Be sure to restart IIS after making changes.
Now when you access http://yourdomain/ , you should see your Plone site instead of the default main page of the vanilla web server.