diff options
author | Gareth Rees <gareth@mysociety.org> | 2014-07-21 15:31:06 +0100 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2014-08-18 13:35:30 +0100 |
commit | 451cbbb460bafc61e2a30148ff828b3e693feb2c (patch) | |
tree | fcd076f440e78a317eb270b286d078428215edbe | |
parent | 1644bd7ff3bcc79ed98ac09e9c0c002d3be8f810 (diff) |
Use try_files instead of two location blocks
-rw-r--r-- | config/nginx.conf.example | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/config/nginx.conf.example b/config/nginx.conf.example index 251d9495d..4ecc0c0d8 100644 --- a/config/nginx.conf.example +++ b/config/nginx.conf.example @@ -3,20 +3,13 @@ upstream alaveteli { } server { - listen 80; - - location / { - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header Host $http_host; - proxy_set_header X-Forwarded-Proto http; - proxy_redirect off; - try_files $uri @ruby; - } + listen 80 default; + server_name www.example.com; root /srv/alaveteli; server_tokens off; + try_files $uri/index.html $uri @alaveteli; error_page 500 502 503 504 /500.html; error_page 404 /404.html; @@ -27,10 +20,14 @@ server { alias /var/www/alaveteli/cache/zips/production/download; } - location @ruby { - proxy_pass http://alaveteli; + location @alaveteli { proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto http; proxy_set_header X-Sendfile-Type X-Accel-Redirect; proxy_set_header X-Accel-Mapping /var/www/alaveteli/cache/zips/production/download=/download; + proxy_redirect off; + proxy_pass http://alaveteli; } } |