Merge pull request #331 from createdbypete/nginx/config-try-files

Changing nginx template to use try_files
This commit is contained in:
Rafael Mendonça França 2013-07-05 07:53:52 -07:00
commit 6912865db8

View file

@ -9,7 +9,6 @@ server {
server_name <%= @server_name %>; server_name <%= @server_name %>;
client_max_body_size 50M; client_max_body_size 50M;
error_page 500 502 503 504 /50x.html; error_page 500 502 503 504 /50x.html;
if ($host ~* "www") { if ($host ~* "www") {
@ -20,19 +19,12 @@ server {
location = /50x.html { location = /50x.html {
root html; root html;
} }
location / { try_files $uri/index.html $uri @<%= @server_name %>;
if (-f $request_filename/index.html) { location @<%= @server_name %> {
rewrite (.*) $1/index.html break; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
} proxy_set_header Host $http_host;
proxy_redirect off;
if (-f $request_filename.html) { proxy_pass http://<%= @server_name %>;
rewrite (.*) $1.html break;
}
if (!-f $request_filename) {
proxy_pass http://<%= @server_name %>;
break;
}
} }
} }