Skip to content

Commit

Permalink
updated docs on FastCGI deployment with Lighty
Browse files Browse the repository at this point in the history
Signed-off-by: Armin Ronacher <armin.ronacher@active-4.com>
  • Loading branch information
fmw authored and mitsuhiko committed Feb 5, 2011
1 parent 4228d72 commit 94f90bc
Showing 1 changed file with 27 additions and 14 deletions.
41 changes: 27 additions & 14 deletions docs/deploying/fastcgi.rst
Expand Up @@ -25,12 +25,13 @@ First you need to create the FastCGI server file. Let's call it
#!/usr/bin/python
from flup.server.fcgi import WSGIServer
from yourapplication import app
if __name__ == '__main__':
WSGIServer(app).run()

WSGIServer(app).run()

This is enough for Apache to work, however lighttpd and nginx need a
socket to communicate with the FastCGI server. For that to work you
need to pass the path to the socket to the
This is enough for Apache to work, however nginx and older versions of
lighttpd need a socket to be explicitly passed to communicate with the FastCGI
server. For that to work you need to pass the path to the socket to the
:class:`~flup.server.fcgi.WSGIServer`::

WSGIServer(application, bindAddress='/path/to/fcgi.sock').run()
Expand All @@ -54,21 +55,33 @@ Configuring lighttpd

A basic FastCGI configuration for lighttpd looks like that::

fastcgi.server = ("/yourapplication" =>
"yourapplication" => (
fastcgi.server = ("/yourapplication.fcgi" =>
((
"socket" => "/tmp/yourapplication-fcgi.sock",
"bin-path" => "/var/www/yourapplication/yourapplication.fcgi",
"check-local" => "disable"
)
"check-local" => "disable",
"max-procs" -> 1
))
)

alias.url = (
"/static/" => "/path/to/your/static"
)

This configuration binds the application to `/yourapplication`. If you
want the application to work in the URL root you have to work around a
lighttpd bug with the :class:`~werkzeug.contrib.fixers.LighttpdCGIRootFix`
middleware.
url.rewrite-once = (
"^(/static.*)$" => "$1",
"^(/.*)$" => "/yourapplication.fcgi$1"

Remember to enable the FastCGI, alias and rewrite modules. This configuration
binds the application to `/yourapplication`. If you want the application to
work in the URL root you have to work around a lighttpd bug with the
:class:`~werkzeug.contrib.fixers.LighttpdCGIRootFix` middleware.

Make sure to apply it only if you are mounting the application the URL
root.
root. Also, see the Lighty docs for more information on `FastCGI and Python
<http://redmine.lighttpd.net/wiki/lighttpd/Docs:ModFastCGI>`_ (note that
explicitly passing a socket to run() is no longer necessary).


Configuring nginx
-----------------
Expand Down

0 comments on commit 94f90bc

Please sign in to comment.