| Left: | ||
| Right: |
| 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 26 matching lines...) Expand all Loading... | |
| 37 | 37 |
| 38 if (-f $request_filename) { | 38 if (-f $request_filename) { |
| 39 break; | 39 break; |
| 40 } | 40 } |
| 41 if (-d $request_filename) { | 41 if (-d $request_filename) { |
| 42 break; | 42 break; |
| 43 } | 43 } |
| 44 | 44 |
| 45 set $static_uri $uri; | 45 set $static_uri $uri; |
| 46 if ($uri ~ ^/(\w\w(_\w\w)?)/(firefox|chrome|opera|android)) { | 46 if ($uri ~ ^/(\w\w(_\w\w)?)/(firefox|chrome|opera|android)) { |
| 47 set $static_uri "/$1"; | 47 set $static_uri "/$1/"; |
| 48 set $browser $3; | |
| 48 } | 49 } |
| 49 set $static ""; | 50 set $static ""; |
| 50 if (-f "$document_root/static$static_uri") { | 51 if (-f "$document_root/static$static_uri") { |
| 51 set $static "ok"; | 52 set $static "ok"; |
| 52 } | 53 } |
| 53 if (-d "$document_root/static$static_uri") { | 54 if (-d "$document_root/static$static_uri") { |
| 54 set $static "ok"; | 55 set $static "ok"; |
| 55 } | 56 } |
| 56 set $static "$static!$arg_a!$cookie_anwiki_anwsesscode"; | 57 set $static "$static!$arg_a!$cookie_anwiki_anwsesscode"; |
| 57 if ($static ~ ^ok!(view|show)?!$) { | 58 if ($static ~ ^ok!(view|show)?!$) { |
| 58 rewrite ^/(\w\w(_\w\w)?)/(firefox|chrome|opera|android) /static/$1/?browse r=$3 last; | 59 rewrite ^ /static$static_uri?browser=$browser last; |
| 59 rewrite (.*) /static/$1 last; | |
|
Wladimir Palant
2012/12/19 16:41:56
Do we need the special case and code duplication f
Felix Dahlke
2012/12/19 20:01:23
You're right, changed that part. I was a bit worri
| |
| 60 } | 60 } |
| 61 | 61 |
| 62 rewrite ^/(\w\w(_\w\w)?)/(firefox|chrome|opera|android) /index.php?p=$1&brow ser=$3 last; | 62 rewrite ^/(\w\w(_\w\w)?)/(firefox|chrome|opera|android) /index.php?p=$1&brow ser=$3 last; |
| 63 rewrite ^/(.*) /index.php?p=$1 last; | 63 rewrite ^/(.*) /index.php?p=$1 last; |
| 64 } | 64 } |
| 65 | 65 |
| 66 location /static/ { | 66 location /static/ { |
| 67 index index; | 67 index index; |
| 68 internal; | 68 internal; |
| 69 types { | 69 types { |
| 70 image/png png; | 70 image/png png; |
| 71 text/xml xml; | 71 text/xml xml; |
| 72 text/css css; | 72 text/css css; |
| 73 } | 73 } |
| 74 default_type text/html; | 74 default_type text/html; |
| 75 charset utf-8; | 75 charset utf-8; |
| 76 | 76 |
| 77 sub_filter ' id="content"' ' id="content" class="$arg_browser"'; | 77 if ($arg_browser) { |
|
Wladimir Palant
2012/12/19 16:41:56
Note that this will affect all pages, not just the
Felix Dahlke
2012/12/19 20:01:23
I've tried to put that sub_filter inside an if, bu
| |
| 78 set $browser_class ' class="$arg_browser"'; | |
| 79 } | |
| 80 sub_filter ' id="content"' ' id="content"$browser_class'; | |
| 78 } | 81 } |
| 79 | 82 |
| 80 | 83 |
| 81 location ~ \.php$ { | 84 location ~ \.php$ { |
| 82 client_max_body_size 8m; | 85 client_max_body_size 8m; |
| 86 | |
| 87 if ($arg_browser) { | |
| 88 set $browser_class ' class="$arg_browser"'; | |
| 89 } | |
| 90 sub_filter ' id="content"' ' id="content"$browser_class'; | |
| 83 | 91 |
| 84 fastcgi_pass unix:/tmp/php-fastcgi.sock; | 92 fastcgi_pass unix:/tmp/php-fastcgi.sock; |
| 85 fastcgi_index index.php; | 93 fastcgi_index index.php; |
| 86 | 94 |
| 87 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; |
| 88 | 96 |
| 89 fastcgi_param QUERY_STRING $query_string; | 97 fastcgi_param QUERY_STRING $query_string; |
| 90 fastcgi_param REQUEST_METHOD $request_method; | 98 fastcgi_param REQUEST_METHOD $request_method; |
| 91 fastcgi_param CONTENT_TYPE $content_type; | 99 fastcgi_param CONTENT_TYPE $content_type; |
| 92 fastcgi_param CONTENT_LENGTH $content_length; | 100 fastcgi_param CONTENT_LENGTH $content_length; |
| 93 | 101 |
| 94 fastcgi_param SCRIPT_NAME $fastcgi_script_name; | 102 fastcgi_param SCRIPT_NAME $fastcgi_script_name; |
| 95 fastcgi_param REQUEST_URI $request_uri; | 103 fastcgi_param REQUEST_URI $request_uri; |
| 96 fastcgi_param DOCUMENT_URI $document_uri; | 104 fastcgi_param DOCUMENT_URI $document_uri; |
| 97 fastcgi_param DOCUMENT_ROOT $document_root; | 105 fastcgi_param DOCUMENT_ROOT $document_root; |
| 98 fastcgi_param SERVER_PROTOCOL $server_protocol; | 106 fastcgi_param SERVER_PROTOCOL $server_protocol; |
| 99 | 107 |
| 100 fastcgi_param GATEWAY_INTERFACE CGI/1.1; | 108 fastcgi_param GATEWAY_INTERFACE CGI/1.1; |
| 101 fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; | 109 fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; |
| 102 | 110 |
| 103 fastcgi_param REMOTE_ADDR $remote_addr; | 111 fastcgi_param REMOTE_ADDR $remote_addr; |
| 104 fastcgi_param REMOTE_PORT $remote_port; | 112 fastcgi_param REMOTE_PORT $remote_port; |
| 105 fastcgi_param SERVER_ADDR $server_addr; | 113 fastcgi_param SERVER_ADDR $server_addr; |
| 106 fastcgi_param SERVER_PORT $server_port; | 114 fastcgi_param SERVER_PORT $server_port; |
| 107 fastcgi_param SERVER_NAME $server_name; | 115 fastcgi_param SERVER_NAME $server_name; |
| 108 | |
| 109 sub_filter ' id="content"' ' id="content" class="$arg_browser"'; | |
|
Wladimir Palant
2012/12/19 16:41:56
Nit: you probably should leave sub_filter in the s
Felix Dahlke
2012/12/19 20:01:23
Done. Thought it made more sense down there but yo
| |
| 110 } | 116 } |
| 111 } | 117 } |
| LEFT | RIGHT |