forked from orbit-oss/flask
Touch up fastcgi doc.
This commit is contained in:
parent
34380b9c1d
commit
fb01187885
1 changed files with 16 additions and 14 deletions
|
|
@ -54,16 +54,19 @@ can execute it:
|
||||||
Configuring Apache
|
Configuring Apache
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
The example above is good enough for a basic Apache deployment but your `.fcgi` file will appear in your application URL e.g. www.example.com/yourapplication.fcgi/news/. There are few ways to resolve it. A preferable way is to use Apache ScriptAlias configuration directive::
|
The example above is good enough for a basic Apache deployment but your `.fcgi`
|
||||||
|
file will appear in your application URL
|
||||||
|
e.g. example.com/yourapplication.fcgi/news/. There are few ways to configure
|
||||||
|
your application so that yourapplication.fcgi does not appear in the URL. A
|
||||||
|
preferable way is to use the ScriptAlias configuration directive::
|
||||||
|
|
||||||
<VirtualHost *>
|
<VirtualHost *>
|
||||||
ServerName example.com
|
ServerName example.com
|
||||||
ScriptAlias / /path/to/yourapplication.fcgi/
|
ScriptAlias / /path/to/yourapplication.fcgi/
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
|
|
||||||
Another way is to use a custom WSGI middleware. For example on a shared web hosting::
|
If you cannot set ScriptAlias, for example on an shared web host, you can use
|
||||||
|
WSGI middleware to remove yourapplication.fcgi from the URLs. Set .htaccess::
|
||||||
.htaccess
|
|
||||||
|
|
||||||
<IfModule mod_fcgid.c>
|
<IfModule mod_fcgid.c>
|
||||||
AddHandler fcgid-script .fcgi
|
AddHandler fcgid-script .fcgi
|
||||||
|
|
@ -81,7 +84,7 @@ Another way is to use a custom WSGI middleware. For example on a shared web host
|
||||||
RewriteRule ^(.*)$ yourapplication.fcgi/$1 [QSA,L]
|
RewriteRule ^(.*)$ yourapplication.fcgi/$1 [QSA,L]
|
||||||
</IfModule>
|
</IfModule>
|
||||||
|
|
||||||
yourapplication.fcgi
|
Set yourapplication.fcgi::
|
||||||
|
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
#: optional path to your local python site-packages folder
|
#: optional path to your local python site-packages folder
|
||||||
|
|
@ -128,16 +131,15 @@ A basic FastCGI configuration for lighttpd looks like that::
|
||||||
"^(/static.*)$" => "$1",
|
"^(/static.*)$" => "$1",
|
||||||
"^(/.*)$" => "/yourapplication.fcgi$1"
|
"^(/.*)$" => "/yourapplication.fcgi$1"
|
||||||
|
|
||||||
Remember to enable the FastCGI, alias and rewrite modules. This
|
Remember to enable the FastCGI, alias and rewrite modules. This configuration
|
||||||
configuration binds the application to `/yourapplication`. If you want
|
binds the application to `/yourapplication`. If you want the application to
|
||||||
the application to work in the URL root you have to work around a
|
work in the URL root you have to work around a lighttpd bug with the
|
||||||
lighttpd bug with the
|
|
||||||
:class:`~werkzeug.contrib.fixers.LighttpdCGIRootFix` middleware.
|
: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. Also, see the Lighty docs for more information on `FastCGI and
|
root. Also, see the Lighty docs for more information on `FastCGI and Python
|
||||||
Python <http://redmine.lighttpd.net/wiki/lighttpd/Docs:ModFastCGI>`_
|
<http://redmine.lighttpd.net/wiki/lighttpd/Docs:ModFastCGI>`_ (note that
|
||||||
(note that explicitly passing a socket to run() is no longer necessary).
|
explicitly passing a socket to run() is no longer necessary).
|
||||||
|
|
||||||
Configuring nginx
|
Configuring nginx
|
||||||
-----------------
|
-----------------
|
||||||
|
|
@ -151,7 +153,7 @@ A basic flask FastCGI configuration for nginx looks like this::
|
||||||
location /yourapplication { try_files $uri @yourapplication; }
|
location /yourapplication { try_files $uri @yourapplication; }
|
||||||
location @yourapplication {
|
location @yourapplication {
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_split_path_info ^(/yourapplication)(.*)$;
|
fastcgi_split_path_info ^(/yourapplication)(.*)$;
|
||||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||||
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
||||||
fastcgi_pass unix:/tmp/yourapplication-fcgi.sock;
|
fastcgi_pass unix:/tmp/yourapplication-fcgi.sock;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue