Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updated docs on FastCGI deployment with Lighty

Signed-off-by: Armin Ronacher <armin.ronacher@active-4.com>
  • Loading branch information...
commit 94f90bc4eb88224d6639cbe94c4e88d8299644e2 1 parent 4228d72
Filip de Waard fmw authored committed
Showing with 27 additions and 14 deletions.
  1. +27 −14 docs/deploying/fastcgi.rst
41 docs/deploying/fastcgi.rst
View
@@ -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()
@@ -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
-----------------
Please sign in to comment.
Something went wrong with that request. Please try again.