Browse Source

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
pull/124/head
Merlin 15 years ago committed by Armin Ronacher
parent
commit
7dae84f002
  1. 23
      docs/deploying/fastcgi.rst

23
docs/deploying/fastcgi.rst

@ -73,26 +73,27 @@ root.
Configuring nginx Configuring nginx
----------------- -----------------
Installing FastCGI applications on nginx is a bit tricky because by default Installing FastCGI applications on nginx is a bit different because by default
some FastCGI parameters are not properly forwarded. 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; include fastcgi_params;
if ($uri ~ ^/yourapplication/(.*)?) { fastcgi_split_path_info ^(/yourapplication)(.*)$;
set $path_url $1; fastcgi_param PATH_INFO $fastcgi_path_info;
} fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param PATH_INFO $path_url;
fastcgi_param SCRIPT_NAME /yourapplication;
fastcgi_pass unix:/tmp/yourapplication-fcgi.sock; fastcgi_pass unix:/tmp/yourapplication-fcgi.sock;
} }
This configuration binds the application to `/yourapplication`. If you want 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`:: out how to calculate `PATH_INFO` and `SCRIPT_NAME`::
location /yourapplication/ { location / { try_files $uri @yourapplication; }
location @yourapplication {
include fastcgi_params; include fastcgi_params;
fastcgi_param PATH_INFO $fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param SCRIPT_NAME ""; fastcgi_param SCRIPT_NAME "";

Loading…
Cancel
Save