Install mod_wsgi

These instructions are not to be considered authoritative instructions, please see http://code.google.com/p/modwsgi/ for the official mod_wsgi docs.

To install mod_wsgi, you can either:

  • Install from a package (for your Linux distro)
  • Build mod_wsgi from source

Install from a packge

Ubuntu/Debian

  • apt-get install libapache2-mod-wsgi

Build mod_wsgi from source

Instruct Apache2 to load mod_wsgi module

Create mod_wsgi.load file

  • cd /etc/apache2/mods-available
  • vi mod_wsgi.load

Add the following text to the file:

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

Symlink in mods-enabled

  • cd /etc/apache2/mods-enabled
  • ln -s ../mods-available/mod_wsgi.load .

Restart Apache2

  • /etc/init.d/apache2 restart

Dealing with specific errors

You might run into these when attempting to install mod_wsgi.

segmentation fault

If you get a segmentation fault, it could be caused by a conflict with an existing mod_python module. See "problems with mod_wsgi and mod_python co-existing" on this page. (next section in fact)

problems with mod_wsgi and mod_python co-existing

The mod_wsgi installation inssues page describes how you should build mod_python and mod_wsgi in order for them to coexist without problems.

apxs: command not found

If you get an error while running configure that says:

apxs: command not found

Then you will need to install the apache2-threaded-dev package (Ubuntu package name, may be different on different distros.

  • apt-get install apache2-threaded-dev

error: Python.h: No such file or directory

If you get this error while running make, you will need the python development headers, for example on an Ubuntu/Debian box:

  • apt-get install python2.5-dev

No apache MPM package installed

If you get this when restarting apache2, then you don't have the webserver installed. On Ubuntu, install by running:

  • apt-get install apache2

Reference

http://code.google.com/p/modwsgi/

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License