How to run a python pyramid application under apache2(httpd) using the mod_wgsi.

Create application user

  useradd appdeploy

Edit /etc/passwd


Create an apache2 config file under /etc/httpd/conf.d/

<virtuallHost *:80>

# Use only 1 Python sub-interpreter.  Multiple sub-interpreters
# play badly with C extensions.  See
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
WSGIDaemonProcess pyramid user=appdeploy    group=appdeploy  threads=4 \
WSGIScriptAlias / /var/www/archive/pyramid.wsgi

<Directory /var/www/archive>
  WSGIProcessGroup pyramid
  Order allow,deny
  Allow from all


Create a WSGI file in the application directory that will be called by the apache2 service.

import os,sys,site

os.environ['PYTHON_EGG_CACHE'] = '/var/www/archive/temp_py'

from pyramid.paster import get_app, setup_logging
ini_path = '/var/www/archive/production.ini'
application = get_app(ini_path, 'main')