Enhanced the nginx deployment subsection of the documentation with working examples.

'tricky' was changed to 'different' to offer a more neutral tone.
'some' was changed to 'no' and 'not properly' swapped with 'by default' to explain the difference.
Configuration allows for static serving of media alongside a FastCGI application in a clean declarative manner.
Tested on nginx 0.7.x and 0.8.x
This commit is contained in:
Merlin 2010-06-04 01:48:44 +08:00 committed by Armin Ronacher
parent 2fb09d07f2
commit 7dae84f002

View file

@ -73,26 +73,27 @@ root.
Configuring nginx
-----------------
Installing FastCGI applications on nginx is a bit tricky because by default
some FastCGI parameters are not properly forwarded.
Installing FastCGI applications on nginx is a bit different because by default
no FastCGI parameters are forwarded.
A basic FastCGI configuration for nginx looks like this::
A basic flask FastCGI configuration for nginx looks like this::
location /yourapplication/ {
location = /yourapplication { rewrite ^ /yourapplication/ last; }
location /yourapplication { try_files $uri @yourapplication; }
location @yourapplication {
include fastcgi_params;
if ($uri ~ ^/yourapplication/(.*)?) {
set $path_url $1;
}
fastcgi_param PATH_INFO $path_url;
fastcgi_param SCRIPT_NAME /yourapplication;
fastcgi_split_path_info ^(/yourapplication)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_pass unix:/tmp/yourapplication-fcgi.sock;
}
This configuration binds the application to `/yourapplication`. If you want
to have it in the URL root it's a bit easier because you don't have to figure
to have it in the URL root it's a bit simpler because you don't have to figure
out how to calculate `PATH_INFO` and `SCRIPT_NAME`::
location /yourapplication/ {
location / { try_files $uri @yourapplication; }
location @yourapplication {
include fastcgi_params;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param SCRIPT_NAME "";