forked from orbit-oss/flask
updated docs on FastCGI deployment with Lighty
Signed-off-by: Armin Ronacher <armin.ronacher@active-4.com>
This commit is contained in:
parent
4228d7281f
commit
94f90bc4eb
1 changed files with 27 additions and 14 deletions
|
|
@ -25,12 +25,13 @@ First you need to create the FastCGI server file. Let's call it
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
from flup.server.fcgi import WSGIServer
|
from flup.server.fcgi import WSGIServer
|
||||||
from yourapplication import app
|
from yourapplication import app
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
WSGIServer(app).run()
|
||||||
|
|
||||||
WSGIServer(app).run()
|
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
|
||||||
This is enough for Apache to work, however lighttpd and nginx need a
|
server. For that to work you need to pass the path to the socket to the
|
||||||
socket 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`::
|
:class:`~flup.server.fcgi.WSGIServer`::
|
||||||
|
|
||||||
WSGIServer(application, bindAddress='/path/to/fcgi.sock').run()
|
WSGIServer(application, bindAddress='/path/to/fcgi.sock').run()
|
||||||
|
|
@ -54,21 +55,33 @@ Configuring lighttpd
|
||||||
|
|
||||||
A basic FastCGI configuration for lighttpd looks like that::
|
A basic FastCGI configuration for lighttpd looks like that::
|
||||||
|
|
||||||
fastcgi.server = ("/yourapplication" =>
|
fastcgi.server = ("/yourapplication.fcgi" =>
|
||||||
"yourapplication" => (
|
((
|
||||||
"socket" => "/tmp/yourapplication-fcgi.sock",
|
"socket" => "/tmp/yourapplication-fcgi.sock",
|
||||||
"bin-path" => "/var/www/yourapplication/yourapplication.fcgi",
|
"bin-path" => "/var/www/yourapplication/yourapplication.fcgi",
|
||||||
"check-local" => "disable"
|
"check-local" => "disable",
|
||||||
)
|
"max-procs" -> 1
|
||||||
|
))
|
||||||
)
|
)
|
||||||
|
|
||||||
This configuration binds the application to `/yourapplication`. If you
|
alias.url = (
|
||||||
want the application to work in the URL root you have to work around a
|
"/static/" => "/path/to/your/static"
|
||||||
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
|
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
|
Configuring nginx
|
||||||
-----------------
|
-----------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue