Skip to content. | Skip to navigation

Personal tools
Log in
You are here: Home How To Plone 3 Virtual Hosting

Virtual Hosting

Update 1/27/09

I have found it now better to use rewrite rules instead of proxying through. An excellent synopsis is found at the plone site. In case that site is down (less likely than this site's being down), here is my configuration:

    DocumentRoot /var/www/htdocs/
    RewriteEngine On
    RewriteRule ^/cv - [L]
    RewriteRule ^/(.*) http://localhost:8080/VirtualHostBase/http/$1 [P,L]

The first RewriteRule opens up a "hole" in my plone site for apache content. For example, try this link:, for which I made a hole in plone to accommodate the complicated CSS applied to my CV. The second RewriteRule is rewrites URLs to the plone virtual host (the VHM).


I like to set up sites such that the plone site takes over the toplevel (i.e. "/") but gets redirected to a subfolder (i.e. "/Home/"). This way, my virtual host is essentially a plone site. But, at the same time, I can have other toplevel directories that can be accessed directly but do not interfere with plone (e.g. ""). I also like to run ubuntu when I run Linux, which uses apache2. Setting up virtual hosting according to several different pages resulted in "403 Forbidden. You don't have permission to access /whatever/file on this server." After some experimentation I have found that the minimal virtual hosting configuration for a successful setup with Apache 2 goes a little something like this:

<VirtualHost *>

    DocumentRoot "/var/www/"

    # override apache2 global defaults
    <Proxy *>
      Order Deny,Allow
      Allow from all

    # disallow use of as open proxy
    <LocationMatch "^[^/]">
       Deny from all

    RewriteEngine On

    # Plone in a sub-folder of an apache site
    RedirectMatch ^/$ /Home
    RewriteRule ^/Home(.*) http://localhost:8080/VirtualHostBase/http/$1 [P,L]   


In the above case, my VHM is named "VirtualHostMonster" and is configured as described at the plone site.

The above example gets around the server's default to disable proxies, but denies open proxy requests. Some might subbornly attempt to use your apache2 as a proxy, but the resulting proxy will be completely useless. I have stumbled across discussions wherein people claim that explicitly allowing the proxy is not required. However, the discussants never describe an alternative configuration. Also, the above "LocationMatch" directive appears in some long standing web pages as a viable prevention to a potential open proxy.