| LEFT | RIGHT |
| 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 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 set $browser "chrome"; | 21 set $browser "chrome"; |
| 22 } | 22 } |
| 23 if ($http_user_agent ~ \bPresto/\d+) { | 23 if ($http_user_agent ~ \bPresto/\d+) { |
| 24 set $browser "opera"; | 24 set $browser "opera"; |
| 25 } | 25 } |
| 26 if ($http_user_agent ~ \bAndroid\s.*\bAppleWebKit/\d+) { | 26 if ($http_user_agent ~ \bAndroid\s.*\bAppleWebKit/\d+) { |
| 27 set $browser "android"; | 27 set $browser "android"; |
| 28 } | 28 } |
| 29 | 29 |
| 30 if ($arg_a ~ ^(view|show)?$) { | 30 if ($arg_a ~ ^(view|show)?$) { |
| 31 rewrite ^/(index\.html)?$ /$preferredLang/#$browser redirect; | 31 rewrite ^/(index\.html)?$ /$preferredLang/$browser redirect; |
| 32 rewrite ^/(\w\w(_\w\w)?)$ /$1/#$browser redirect; | 32 rewrite ^/(\w\w(_\w\w)?)$ /$1/$browser redirect; |
| 33 } | 33 } |
| 34 | 34 |
| 35 rewrite ^/(\w\w(_\w\w)?)/(firefox|chrome|opera|android) /$1/#$3 permanent; | |
| 36 rewrite ^/(\w\w(_\w\w)?)/installation$ /$1/ permanent; | 35 rewrite ^/(\w\w(_\w\w)?)/installation$ /$1/ permanent; |
| 37 rewrite ^/anwiki/(.*) /$1 permanent; | 36 rewrite ^/anwiki/(.*) /$1 permanent; |
| 38 | 37 |
| 39 if (-f $request_filename) { | 38 if (-f $request_filename) { |
| 40 break; | 39 break; |
| 41 } | 40 } |
| 42 if (-d $request_filename) { | 41 if (-d $request_filename) { |
| 43 break; | 42 break; |
| 44 } | 43 } |
| 45 | 44 |
| 45 set $static_uri $uri; |
| 46 if ($uri ~ ^/(\w\w(_\w\w)?)/(firefox|chrome|opera|android)) { |
| 47 set $static_uri "/$1/"; |
| 48 set $browser $3; |
| 49 } |
| 46 set $static ""; | 50 set $static ""; |
| 47 if (-f "$document_root/static$uri") { | 51 if (-f "$document_root/static$static_uri") { |
| 48 set $static "ok"; | 52 set $static "ok"; |
| 49 } | 53 } |
| 50 if (-d "$document_root/static$uri") { | 54 if (-d "$document_root/static$static_uri") { |
| 51 set $static "ok"; | 55 set $static "ok"; |
| 52 } | 56 } |
| 53 set $static "$static!$arg_a!$cookie_anwiki_anwsesscode"; | 57 set $static "$static!$arg_a!$cookie_anwiki_anwsesscode"; |
| 54 if ($static ~ ^ok!(view|show)?!$) { | 58 if ($static ~ ^ok!(view|show)?!$) { |
| 55 rewrite (.*) /static$1 last; | 59 rewrite ^ /static$static_uri?browser=$browser last; |
| 56 } | 60 } |
| 57 | 61 |
| 62 rewrite ^/(\w\w(_\w\w)?)/(firefox|chrome|opera|android) /index.php?p=$1&brow
ser=$3 last; |
| 58 rewrite ^/(.*) /index.php?p=$1 last; | 63 rewrite ^/(.*) /index.php?p=$1 last; |
| 59 } | 64 } |
| 60 | 65 |
| 61 location /static/ { | 66 location /static/ { |
| 62 index index; | 67 index index; |
| 63 internal; | 68 internal; |
| 64 types { | 69 types { |
| 65 image/png png; | 70 image/png png; |
| 66 text/xml xml; | 71 text/xml xml; |
| 67 text/css css; | 72 text/css css; |
| 68 } | 73 } |
| 69 default_type text/html; | 74 default_type text/html; |
| 70 charset utf-8; | 75 charset utf-8; |
| 71 | 76 |
| 72 set $browserClass ' nongecko'; | 77 if ($arg_browser) { |
| 73 if ($http_user_agent ~ \bGecko/\d+) { | 78 set $browser_class ' class="$arg_browser"'; |
| 74 set $browserClass ' gecko'; | |
| 75 } | 79 } |
| 76 if ($http_user_agent ~ \bK-Meleon\b) { | 80 sub_filter ' id="content"' ' id="content"$browser_class'; |
| 77 set $browserClass ' kmeleon'; | |
| 78 } | |
| 79 if ($http_user_agent ~ \bChrome/\d+) { | |
| 80 set $browserClass ' chrome'; | |
| 81 } | |
| 82 if ($http_user_agent ~ \bPresto/\d+) { | |
| 83 set $browserClass ' opera'; | |
| 84 } | |
| 85 sub_filter ' id="content" class="multicolumn"' ' id="content" class="multi
column$browserClass"'; | |
| 86 } | 81 } |
| 87 | 82 |
| 88 | 83 |
| 89 location ~ \.php$ { | 84 location ~ \.php$ { |
| 90 client_max_body_size 8m; | 85 client_max_body_size 8m; |
| 91 | 86 |
| 92 set $browserClass ' nongecko'; | 87 if ($arg_browser) { |
| 93 if ($http_user_agent ~ \bGecko/\d+) { | 88 set $browser_class ' class="$arg_browser"'; |
| 94 set $browserClass ' gecko'; | |
| 95 } | 89 } |
| 96 if ($http_user_agent ~ \bK-Meleon\b) { | 90 sub_filter ' id="content"' ' id="content"$browser_class'; |
| 97 set $browserClass ' kmeleon'; | |
| 98 } | |
| 99 if ($http_user_agent ~ \bChrome/\d+) { | |
| 100 set $browserClass ' chrome'; | |
| 101 } | |
| 102 if ($http_user_agent ~ \bPresto/\d+) { | |
| 103 set $browserClass ' opera'; | |
| 104 } | |
| 105 sub_filter ' id="content" class="multicolumn"' ' id="content" class="multico
lumn$browserClass"'; | |
| 106 | 91 |
| 107 fastcgi_pass unix:/tmp/php-fastcgi.sock; | 92 fastcgi_pass unix:/tmp/php-fastcgi.sock; |
| 108 fastcgi_index index.php; | 93 fastcgi_index index.php; |
| 109 | 94 |
| 110 fastcgi_param SCRIPT_FILENAME /var/www/adblockplus.org/phproot$fastcgi_scrip
t_name; | 95 fastcgi_param SCRIPT_FILENAME /var/www/adblockplus.org/phproot$fastcgi_scrip
t_name; |
| 111 | 96 |
| 112 fastcgi_param QUERY_STRING $query_string; | 97 fastcgi_param QUERY_STRING $query_string; |
| 113 fastcgi_param REQUEST_METHOD $request_method; | 98 fastcgi_param REQUEST_METHOD $request_method; |
| 114 fastcgi_param CONTENT_TYPE $content_type; | 99 fastcgi_param CONTENT_TYPE $content_type; |
| 115 fastcgi_param CONTENT_LENGTH $content_length; | 100 fastcgi_param CONTENT_LENGTH $content_length; |
| 116 | 101 |
| 117 fastcgi_param SCRIPT_NAME $fastcgi_script_name; | 102 fastcgi_param SCRIPT_NAME $fastcgi_script_name; |
| 118 fastcgi_param REQUEST_URI $request_uri; | 103 fastcgi_param REQUEST_URI $request_uri; |
| 119 fastcgi_param DOCUMENT_URI $document_uri; | 104 fastcgi_param DOCUMENT_URI $document_uri; |
| 120 fastcgi_param DOCUMENT_ROOT $document_root; | 105 fastcgi_param DOCUMENT_ROOT $document_root; |
| 121 fastcgi_param SERVER_PROTOCOL $server_protocol; | 106 fastcgi_param SERVER_PROTOCOL $server_protocol; |
| 122 | 107 |
| 123 fastcgi_param GATEWAY_INTERFACE CGI/1.1; | 108 fastcgi_param GATEWAY_INTERFACE CGI/1.1; |
| 124 fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; | 109 fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; |
| 125 | 110 |
| 126 fastcgi_param REMOTE_ADDR $remote_addr; | 111 fastcgi_param REMOTE_ADDR $remote_addr; |
| 127 fastcgi_param REMOTE_PORT $remote_port; | 112 fastcgi_param REMOTE_PORT $remote_port; |
| 128 fastcgi_param SERVER_ADDR $server_addr; | 113 fastcgi_param SERVER_ADDR $server_addr; |
| 129 fastcgi_param SERVER_PORT $server_port; | 114 fastcgi_param SERVER_PORT $server_port; |
| 130 fastcgi_param SERVER_NAME $server_name; | 115 fastcgi_param SERVER_NAME $server_name; |
| 131 } | 116 } |
| 132 } | 117 } |
| LEFT | RIGHT |