[Web-SIG] [ANN] nginx wsgi module draft

Manlio Perillo manlio_perillo at libero.it
Sat Sep 15 18:47:56 CEST 2007


Hi all, this my first post here.

I'm pleased to announce the availability of the first working draft of
the wsgi module for nginx.

nginx (http://nginx.net/) is a high performance open source web server
written by Igor Sysoev.

The code is available as a Mercurial repository:
http://hg.mperillo.ath.cx/nginx/mod_wsgi/

It is possible to download a snapshot in gzip format:
http://hg.mperillo.ath.cx/nginx/mod_wsgi/archive/tip.tar.gz

I have not yet defined a tag, but I'm tring to commit only full working
code.

There is still a lot of work to do and the current implementation has
some limitations (some for design choices, others for keeping the
implementation as simple as possible, at least for the first versions):

1) I have implemented the WSGI 2.0 draft
    (http://wsgi.org/wsgi/WSGI_2.0)
2) "app_iter" must produce only one item
3) Exceptions are not logged
4) Only one WSGI app can be executed, for a given nginx instance
5) SCRIPT_NAME e PATH_INFO environment variables are not supported
    (I have asked for help some messages ago)


IMPORTANT: Since the WSGI application is executed in the nginx process
            cycle, it can block the entire server.

The documentation is still missing, but you can use the documentation
that came with Apache mod_wsgi:
http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives

nginx mod_wsgi additionally supports the directive "wsgi_param", similar
to fastcgi_param:
http://wiki.codemongers.com/NginxHttpFcgiModule#fastcgi_param

In conf/wsgi_params there are defined tha params required by WSGI.

In example/ there is a small example

To compile nginx, it suffice to do something like:
./configure --add-module=/home/manlio/projects/hg/nginx/mod_wsgi/ \
             --with-debug
make
make install

from the main directory of the nginx sources (I'm using version 0.5.31).

By default nginx is installed in /usr/local/nginx, I suggest to choose
as --prefix path a directory where you have write access as a limited
user, so you can install and execute nginx withoud being root.

I would like to thank Igor Sysoev for having released nginx with an Open
Source license, and for having written such a good code (although I
would like to see more documentation :-)).

Many thanks to Evan Miller for his Guide To Nginx Module Development.

And many thanks to Graham Dumpleton (the author of the WSGI module
implementation for Apache) since his module has been an invaluable
resource for me.
ngx_http_wsgi_module contains some pieces of code taken from mod_wsgi.c.



I hope that nginx wsgi module will help to make WSGI more "asyncronous
app" friendly, since the current implementation seems to not address web
servers like nginx.


Manlio Perillo



More information about the Web-SIG mailing list