mod_wsgi + Zope2 + Plone + virtual hosting configuration

543 Views Asked by At

I have configured Plone with the following buildout (via http://build.pythonpackages.com/buildout/plone/4.2.x):

[buildout]
allow-hosts =
    *.plone.org
    *.python.org
extensions = buildout.bootstrap
extends = http://dist.plone.org/release/4.2b1/versions.cfg
find-links = http://dist.plone.org/thirdparty/elementtree-1.2.7-20070827-preview.zip
parts =
    mod-wsgi
    plone
    plone-mod-wsgi
    plone-paste
versions = versions

[mod-wsgi]
recipe = collective.recipe.modwsgi
eggs = ${plone:eggs}
config-file = ${buildout:directory}/plone-mod-wsgi.ini

[plone]
recipe = plone.recipe.zope2instance
eggs =
    PasteScript
    Pillow
    Plone
    WebError
    repoze.retry
    repoze.tm2
    repoze.vhm
products =
user = admin:admin
scripts = paster

[plone-mod-wsgi]
recipe = collective.recipe.template
url = http://build.pythonpackages.com/buildout/plone/plone-mod-wsgi.ini.in
output = ${buildout:directory}/plone-mod-wsgi.ini

[plone-paste]
recipe = collective.recipe.template
url = http://build.pythonpackages.com/buildout/plone/plone-paste.ini.in
output = ${buildout:directory}/plone-paste.ini

[versions]
distribute = 0.6.24
zc.buildout = 1.5.2
Zope2 = 2.13.11

And Apache with the following config:

<VirtualHost *:80>
    …

    # Use only 1 Python sub-interpreter.  Multiple sub-interpreters
    # play badly with C extensions.
    WSGIApplicationGroup %{GLOBAL}
    WSGIPassAuthorization On
    WSGIDaemonProcess plone user=aclark group=staff processes=1 \
       threads=4 \
       python-path=/srv/aclark.net/eggs
    WSGIScriptAlias / /srv/aclark.net/parts/mod-wsgi/wsgi

    <Directory /srv/aclark.net>
      WSGIProcessGroup plone
      Order allow,deny
      Allow from all
      SetEnv HTTP_X_VHM_HOST http://aclark.net
      SetEnv HTTP_X_VHM_ROOT /Plone
    </Directory>

</VirtualHost>

My "declarative" WSGI configuration (called by /srv/aclark.net/parts/mod-wsgi/wsgi) looks like this:

[app:plone]
use = egg:Zope2#main
zope_conf = /srv/aclark.net/parts/plone/etc/zope.conf

[pipeline:main]
pipeline =
    egg:repoze.retry#retry
    egg:repoze.tm2#tm
    egg:repoze.vhm#vhm_xheaders
    plone

# Begin logging configuration

[loggers]
keys = root

[handlers]
keys = console

[formatters]
keys = generic

[logger_root]
level = WARN
handlers = console

[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic

[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s

# End logging configuration

This all partially works, by loading http://aclark.net/Plone when you ask for http://aclark.net. However Zope2 is still generating URLs that begin with http://aclark.net/Plone.

Am I missing something? Or is this a Zope2 bug (not doing the right thing when conifgured w/repoze.vhm)

2

There are 2 best solutions below

0
On BEST ANSWER

Full WSGI support for Zope2 is still a work in progress. See:

1
On

what about:

[filter:vhm]
use = egg:repoze.vhm#vhm_explicit
host = http://www.example.com
root = /mysite