WSGI on Phusion Passenger

WSGI support is not documented in the Users guide because WSGI is mostly a proof of concept right now. But, just in case people want to tinker around with it, here’s how you can host a WSGI application on Phusion Passenger:

$ mkdir /webapps
$ mkdir /webapps/wsgi
$ cd /webapps/wsgi
$ mkdir public
$ mkdir tmp
$ some_favorite_editor
....edit file...
$ cat
def application(environ, start_response):
	start_response('200 OK', [('Content-type', 'text/plain'), ('X-Foo', 'bar')])
	return ['Hello World!<br><img src="">']

Next, add a virtual host directive to your Apache config file:

<VirtualHost *:80>
    ServerName www.wsgi.test
    DocumentRoot /webapps/wsgi/public


  1. Kevin Evans said,

    June 11, 2008 @ 11:30 pm

    While a ‘proof of concept’, it does seem to work for Django ..

  2. Nome do Jogo » Artigo » Rails Podcast Brasil - Episdio 21 said,

    June 19, 2008 @ 2:08 pm

    […] WSGI on Phusion […]

  3. Miza Hearst said,

    November 5, 2009 @ 4:20 am

    I have setup Apache with mod_wsgi and passenger support and now am attempting to run satchmo with passenger. No luck thus far.

    Kevin your claim that it works with django can’t hardly be the case. Django is not loaded by Apache in your github example. If you would modify your example so to it works with a bare minimum django app, that’d be helpful since no-one else has as far as I can tell 🙂

  4. Karl Blessing said,

    January 2, 2010 @ 3:18 am

    On my server, root is setup to use Python 2.6, and I have no other users (no one in /home) , but passenger is running python/wsgi in the original 2.4

    I have this in my root’s bash_profile

    alias python=’/opt/py26/bin/python’
    alias python2.6=’/opt/py26/bin/python’

  5. Nginx, Passenger and WSGI » Geek and Artist said,

    June 24, 2012 @ 11:09 pm

    […] has been touched on in various levels of detail on Hongli’s own blog, the official Phusion blog, and the Dreamhost wiki, among other sites. You can piece together a […]

RSS feed for comments on this post · TrackBack URI

Leave a Comment

You must be logged in to post a comment.