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:
parent
2fb09d07f2
commit
7dae84f002
1 changed files with 12 additions and 11 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue