From 0e78e785982dacdb9af6a2be17262f6739f947d0 Mon Sep 17 00:00:00 2001 From: Matt Robenolt Date: Mon, 26 May 2014 20:20:15 -0700 Subject: [PATCH] Update nginx config to reflect best practice Should use `try_files` then fall back to a named location block. This is also what's recommended inside the docs already: http://gunicorn-docs.readthedocs.org/en/latest/deploy.html#nginx-configuration --- examples/nginx.conf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/nginx.conf b/examples/nginx.conf index 5ed8f87c..6e361d06 100644 --- a/examples/nginx.conf +++ b/examples/nginx.conf @@ -86,6 +86,11 @@ http { root /path/to/app/current/public; location / { + # checks for static file, if not found proxy to app + try_files $uri @proxy_to_app; + } + + location @proxy_to_app { # an HTTP header important enough to have its own Wikipedia entry: # http://en.wikipedia.org/wiki/X-Forwarded-For proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;