| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| 1 server { | 1 server { |
| 2 root /var/www/adblockplus.org/httpdocs; | 2 root /var/www/adblockplus.org/httpdocs; |
| 3 | 3 |
| 4 location / { | 4 location / { |
| 5 index index.php index index.html; | 5 index index.php index index.html; |
| 6 | 6 |
| 7 if ($arg_a = "view") { | 7 if ($arg_a = "view") { |
| 8 rewrite ^(.*) $1? permanent; | 8 rewrite ^(.*) $1? permanent; |
| 9 } | 9 } |
| 10 | 10 |
| 11 set $preferredLang en; | 11 set $preferredLang en; |
| 12 if ($http_accept_language ~ ^(\w\w)\b) { | 12 if ($http_accept_language ~ ^(\w\w)\b) { |
| 13 set $preferredLang $1; | 13 set $preferredLang $1; |
| 14 } | 14 } |
| 15 if (!-f $document_root/static/$preferredLang/index) { | 15 if (!-f $document_root/static/$preferredLang/index) { |
| 16 set $preferredLang en; | 16 set $preferredLang en; |
| 17 } | 17 } |
| 18 | 18 |
| 19 if ($arg_a ~ ^(view|show)?$) { | 19 if ($http_user_agent ~ \bChrome/\d+) { |
| 20 rewrite ^/(index\.html)?$ /$preferredLang/? redirect; | 20 set $browser "chrome"; |
| 21 rewrite ^/(\w\w(_\w\w)?)$ /$1/ redirect; | 21 } |
| 22 if ($http_user_agent ~ \bPresto/\d+) { | |
| 23 set $browser "opera"; | |
| 24 } | |
| 25 if ($http_user_agent !~ \bChrome/\d+) { | |
|
Wladimir Palant
2012/12/19 11:16:39
Actually, it wasn't broken before - a rewrite stat
Felix Dahlke
2012/12/19 11:45:30
Right, didn't think there. I presumed this was jus
| |
| 26 set $browser "firefox"; | |
| 22 } | 27 } |
| 23 | 28 |
| 24 rewrite ^/(\w\w)/installation$ /$1/ permanent; | 29 if ($arg_a ~ ^(view|show)?$) { |
| 30 rewrite ^/(index\.html)?$ /$preferredLang/#$browser redirect; | |
| 31 rewrite ^/(\w\w(_\w\w)?)$ /$1/#$browser redirect; | |
| 32 } | |
| 33 | |
| 34 rewrite ^/(\w\w(_\w\w)?)/(firefox|chrome|opera) /$1/#$3 permanent; | |
|
Wladimir Palant
2012/12/19 11:16:39
Also android.
| |
| 35 rewrite ^/(\w\w(_\w\w)?)/installation$ /$1/ permanent; | |
|
Felix Dahlke
2012/12/19 10:32:09
This one I did fix while I was at it.
Wladimir Palant
2012/12/19 11:16:39
Actually, I think that zh_CN was only added after
| |
| 25 rewrite ^/anwiki/(.*) /$1 permanent; | 36 rewrite ^/anwiki/(.*) /$1 permanent; |
| 26 | 37 |
| 27 if (-f $request_filename) { | 38 if (-f $request_filename) { |
| 28 break; | 39 break; |
| 29 } | 40 } |
| 30 if (-d $request_filename) { | 41 if (-d $request_filename) { |
| 31 break; | 42 break; |
| 32 } | 43 } |
| 33 | 44 |
| 34 if ($http_user_agent ~ \bChrome/\d+) { | |
| 35 rewrite ^/(\w\w(_\w\w)?)/?$ /$1/chrome; | |
| 36 } | |
| 37 if ($http_user_agent ~ \bPresto/\d+) { | |
| 38 rewrite ^/(\w\w(_\w\w)?)/?$ /$1/opera; | |
| 39 } | |
| 40 if ($http_user_agent !~ \bChrome/\d+) { | |
| 41 rewrite ^/(\w\w(_\w\w)?)/?$ /$1/firefox; | |
| 42 } | |
| 43 | |
| 44 set $static ""; | 45 set $static ""; |
| 45 if (-f "$document_root/static$uri") { | 46 if (-f "$document_root/static$uri") { |
| 46 set $static "ok"; | 47 set $static "ok"; |
| 47 } | 48 } |
| 48 if (-d "$document_root/static$uri") { | 49 if (-d "$document_root/static$uri") { |
| 49 set $static "ok"; | 50 set $static "ok"; |
| 50 } | 51 } |
| 51 set $static "$static!$arg_a!$cookie_anwiki_anwsesscode"; | 52 set $static "$static!$arg_a!$cookie_anwiki_anwsesscode"; |
| 52 if ($static ~ ^ok!(view|show)?!$) { | 53 if ($static ~ ^ok!(view|show)?!$) { |
| 53 rewrite (.*) /static$1 last; | 54 rewrite (.*) /static$1 last; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 fastcgi_param GATEWAY_INTERFACE CGI/1.1; | 122 fastcgi_param GATEWAY_INTERFACE CGI/1.1; |
| 122 fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; | 123 fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; |
| 123 | 124 |
| 124 fastcgi_param REMOTE_ADDR $remote_addr; | 125 fastcgi_param REMOTE_ADDR $remote_addr; |
| 125 fastcgi_param REMOTE_PORT $remote_port; | 126 fastcgi_param REMOTE_PORT $remote_port; |
| 126 fastcgi_param SERVER_ADDR $server_addr; | 127 fastcgi_param SERVER_ADDR $server_addr; |
| 127 fastcgi_param SERVER_PORT $server_port; | 128 fastcgi_param SERVER_PORT $server_port; |
| 128 fastcgi_param SERVER_NAME $server_name; | 129 fastcgi_param SERVER_NAME $server_name; |
| 129 } | 130 } |
| 130 } | 131 } |
| OLD | NEW |