OLD | NEW |
1 expires 1d; | 1 expires 1d; |
2 | 2 |
3 root /var/www/<%= vhost %>; | 3 root /var/www/<%= vhost %>; |
4 index index; | 4 index index; |
5 default_type text/html; | 5 default_type text/html; |
6 charset utf-8; | 6 charset utf-8; |
7 | 7 |
8 set $index_page "index"; | 8 set $index_page "index"; |
9 | 9 |
10 <% if @custom_config %> | 10 <% if @custom_config %> |
(...skipping 10 matching lines...) Expand all Loading... |
21 { | 21 { |
22 set $preferredLang $1; | 22 set $preferredLang $1; |
23 } | 23 } |
24 if ($http_accept_language ~ ^\w\w-(\w\w)\b) | 24 if ($http_accept_language ~ ^\w\w-(\w\w)\b) |
25 { | 25 { |
26 set $preferredRegion $1; | 26 set $preferredRegion $1; |
27 } | 27 } |
28 | 28 |
29 # Redirect canonical URLs to language-specific versions | 29 # Redirect canonical URLs to language-specific versions |
30 | 30 |
31 if (-f "$document_root/${preferredLang}_$preferredRegion$uri") | 31 if (-e "$document_root/${preferredLang}_$preferredRegion$uri") |
32 { | 32 { |
33 rewrite ^(.*) /${preferredLang}_$preferredRegion$1 last; | 33 rewrite ^(.*) /${preferredLang}_$preferredRegion$1 last; |
34 } | 34 } |
35 if (-f "$document_root/$preferredLang$uri") | 35 if (-e "$document_root/$preferredLang$uri") |
36 { | 36 { |
37 rewrite ^(.*) /$preferredLang$1 last; | 37 rewrite ^(.*) /$preferredLang$1 last; |
38 } | 38 } |
39 if (-f "$document_root/en$uri") | 39 if (-e "$document_root/en$uri") |
40 { | 40 { |
41 rewrite ^(.*) /en$1 last; | 41 rewrite ^(.*) /en$1 last; |
42 } | 42 } |
43 | 43 |
44 # Redirect server/language root | 44 # Redirect server/language root |
45 | 45 |
46 rewrite ^/$ /$index_page last; | 46 rewrite ^/$ /$index_page last; |
47 rewrite ^/(\w\w(_\w\w)?)$ /$1/ permanent; | 47 rewrite ^/(\w\w(_\w\w)?)$ /$1/ permanent; |
48 rewrite ^/(\w\w(_\w\w)?)/$ /$1/$index_page last; | 48 rewrite ^/(\w\w(_\w\w)?)/$ /$1/$index_page last; |
49 } | 49 } |
50 | 50 |
51 <% if @multiplexer_locations %> | 51 <% if @multiplexer_locations %> |
52 <% @multiplexer_locations.each do |location| %> | 52 <% @multiplexer_locations.each do |location| %> |
53 location <%= location %> | 53 location <%= location %> |
54 { | 54 { |
55 fastcgi_pass unix:/tmp/multiplexer-fastcgi.sock; | 55 fastcgi_pass unix:/tmp/multiplexer-fastcgi.sock; |
56 include /etc/nginx/fastcgi_params; | 56 include /etc/nginx/fastcgi_params; |
57 } | 57 } |
58 <% end %> | 58 <% end %> |
59 <% end %> | 59 <% end %> |
OLD | NEW |