Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Updated documentation for deploying with Lighttpd #165

Closed
wants to merge 1 commit into from

2 participants

@fmw
fmw commented

I've updated the documentation for Lighttpd deployment with FastCGI.

@mitsuhiko
Owner

Thanks a lot. I pulled these. Should be online with the next documentation rebuild.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 4, 2011
  1. @fmw
This page is out of date. Refresh to see the latest.
Showing with 27 additions and 14 deletions.
  1. +27 −14 docs/deploying/fastcgi.rst
View
41 docs/deploying/fastcgi.rst
@@ -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
-----------------
Something went wrong with that request. Please try again.