Personal tools
You are here: Home Documentation Tutorials Install Plone 3 behind Apache and mod_wsgi using Repoze Installing and configuring mod_wsgi
Support

Get Help

Join our chat rooms or support forums if you have more specific questions.

Plone Training
Learn how to design, build, and deploy a website in Plone through one of the numerous Plone training sessions around the world.
Find Plone training…
 
Document Actions

Installing and configuring mod_wsgi

mod_wsgi is installed the same way as any Apache module

Carlos de la Guardia

Repoze allows Plone and Zope to run behind any WSGI server. This tutorial will show how to install Plone 3 behind the Apache web server and mod_wsgi using Repoze on a brand new Linux virtual server.
Page 4 of 5.

Now, the server is ready for mod_wsgi. Since there is no package for this in Ubuntu 7.10, we need to get it directly from the download site:

$ wget http://modwsgi.googlecode.com/files/mod_wsgi-2.0c4.tar.gz

$ tar xzf mod_wsgi-2.0c4.tar.gz
$ cd mod_wsgi-2.0c4
$ ./configure --with-python=/usr/bin/python2.4
$ make
$ make install

Note that it is necessary to compile mod_wsgi using the same Python you will use to run your web site. Since Zope requires 2.4, the --with-python option was used to point to the newly installed Python.

Once mod_wsgi is intalled, the apache server needs to be told about it. On Apache 2, this is done by adding the load declaration and any configuration directives inside the mods-available directory.

The load declaration was put on a file named wsgi.load, which contains only this:

LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so

The configuration directives reside in the file named wsgi.conf, they contain an almost identical configuration to the one shown on the repoze.org site, on the deployment page. Replace ${sandbox} below with the path to your Repoze installation's top-level environment.

WSGIPythonHome ${sandbox}
WSGIDaemonProcess tmp threads=1 processes=4 maximum-requests=10000 python-path=${sandbox}/lib/python2.4/site-packages
<VirtualHost *:80>
  ServerName my.machine.local
  WSGIScriptAlias /site ${sandbox}/bin/zope2.wsgi
  WSGIProcessGroup tmp
  WSGIPassAuthorization On
  SetEnv HTTP_X_VHM_HOST http://my.machine.local/site
  SetEnv PASTE_CONFIG ${sandbox}/etc/zope2.ini
</VirtualHost>

This will run mod_wsgi in 'daemon' mode, which means it will launch a number of processes to run the configured WSGI application instead of using the Apache process. Since Repoze uses virtualenv, the site-packages directory of the virtual Python used to run it needs to be passed in the python-path variable. To tell mod_wsgi which WSGI application to run, we use the WSGIScriptAlias directive and pass it the path to the desired application.

To really activate this configuration files, another step is required, which is to create soft links for them under the mods-enabled directory of the Apache configuration:

$ cd mods-enabled
$ ln -s ../mods-available/wsgi.load
$ ln -s ../mods-available/wsgi.conf

For apache 1.3 or Apache 2 with an old directory layout, you may need to put both of these snippets inside the httpd.conf file in your Apache's /etc directory. The soft links above will not be necessary in that case.

 
by Carlos de la Guardia last modified July 14, 2008 - 18:18 All content is copyright Plone Foundation and the individual contributors.

For any issues with the web site functionality, please file a ticket.

Please consult the policy on plone.org content if you want your content published on this site.

Servers and hosting by