Skip to content
Myr

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

Before adoption: this commit came in with the history the project adopted, so no landing records it.

'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

authored by Merlin · committed by Armin Ronacher · parent 2fb09d0 · Browse files · 1 file+12 added−11 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+12 added−11 removed

  • other:+12 added−11 removed

1 file+12 added−11 removed

modified:docs/deploying/fastcgi.rst+12 added-11 removed
71 unmodified lines
7273Configuring nginx74-----------------7576Installing FastCGI applications on nginx is a bit tricky because by default77some FastCGI parameters are not properly forwarded.76Installing FastCGI applications on nginx is a bit different because by default77no FastCGI parameters are forwarded.7879A basic FastCGI configuration for nginx looks like this::79A basic flask FastCGI configuration for nginx looks like this::8081 location /yourapplication/ {81 location = /yourapplication { rewrite ^ /yourapplication/ last; }82 location /yourapplication { try_files $uri @yourapplication; }83 location @yourapplication {84 include fastcgi_params;83 if ($uri ~ ^/yourapplication/(.*)?) {84 set $path_url $1;85 }86 fastcgi_param PATH_INFO $path_url;87 fastcgi_param SCRIPT_NAME /yourapplication;85 fastcgi_split_path_info ^(/yourapplication)(.*)$;86 fastcgi_param PATH_INFO $fastcgi_path_info;87 fastcgi_param SCRIPT_NAME $fastcgi_script_name;88 fastcgi_pass unix:/tmp/yourapplication-fcgi.sock;89 }9091This configuration binds the application to `/yourapplication`. If you want92to have it in the URL root it's a bit easier because you don't have to figure92to have it in the URL root it's a bit simpler because you don't have to figure93out how to calculate `PATH_INFO` and `SCRIPT_NAME`::9495 location /yourapplication/ {95 location / { try_files $uri @yourapplication; }96 location @yourapplication {97 include fastcgi_params;98 fastcgi_param PATH_INFO $fastcgi_script_name;99 fastcgi_param SCRIPT_NAME "";100 fastcgi_pass unix:/tmp/yourapplication-fcgi.sock;
39 unmodified lines