Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: modules/adblockplusorg/files/adblockplus.org

Issue 9425007: Remove website development VM (Closed)
Patch Set: Created Feb. 20, 2013, 3:53 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 server {
2 root /var/www/adblockplus.org/httpdocs;
3
4 location / {
5 index index.php index index.html;
6
7 if ($arg_a = "view") {
8 rewrite ^(.*) $1? permanent;
9 }
10
11 set $preferredLang en;
12 if ($http_accept_language ~ ^(\w\w)\b) {
13 set $preferredLang $1;
14 }
15 if (!-f $document_root/static/$preferredLang/index) {
16 set $preferredLang en;
17 }
18
19 set $user_agent "";
20 if ($http_user_agent ~ \bGecko/\d+) {
21 set $user_agent "firefox";
22 }
23 if ($http_user_agent ~ \bChrome/\d+) {
24 set $user_agent "chrome";
25 }
26 if ($http_user_agent ~ \bPresto/\d+) {
27 set $user_agent "opera";
28 }
29 if ($http_user_agent ~ \bAndroid\s.*\bAppleWebKit/\d+) {
30 set $user_agent "android";
31 }
32
33 set $platform "firefox";
34 if ($user_agent) {
35 set $platform $user_agent;
36 }
37
38 if ($arg_a ~ ^(view|show)?$) {
39 rewrite ^/(index\.html)?$ /$preferredLang/$platform redirect;
40 rewrite ^/(\w\w(_\w\w)?)/?$ /$1/$platform redirect;
41 }
42
43 rewrite ^/(\w\w(_\w\w)?)/installation$ /$1/ permanent;
44 rewrite ^/anwiki/(.*) /$1 permanent;
45
46 if (-f $request_filename) {
47 break;
48 }
49 if (-d $request_filename) {
50 break;
51 }
52
53 set $static_uri $uri;
54 if ($uri ~ ^/(\w\w(_\w\w)?)/(firefox|chrome|opera|android)/?$) {
55 set $static_uri "/$1/";
56 set $platform $3;
57 }
58 set $static "";
59 if (-f "$document_root/static$static_uri") {
60 set $static "ok";
61 }
62 if (-f "$document_root/static$static_uri/index") {
63 set $static "ok";
64 }
65 set $static "$static!$arg_a!$cookie_anwiki_anwsesscode";
66 if ($static ~ ^ok!(view|show)?!$) {
67 rewrite ^ /static$static_uri?platform=$platform&user_agent=$user_agent las t;
68 }
69
70 rewrite ^/(\w\w(_\w\w)?)/(firefox|chrome|opera|android)/?$ /index.php?p=$1&p latform=$3&user_agent=$user_agent last;
71 rewrite ^/(.*) /index.php?p=$1 last;
72 }
73
74 location /static/ {
75 index index;
76 internal;
77 types {
78 image/png png;
79 text/xml xml;
80 text/css css;
81 }
82 default_type text/html;
83 charset utf-8;
84
85 set $platform_class '';
86 if ($arg_platform) {
87 set $platform_class ' class="$arg_platform ua-$arg_user_agent"';
88 }
89 sub_filter ' id="content"' ' id="content"$platform_class';
90 }
91
92
93 location ~ \.php$ {
94 client_max_body_size 8m;
95
96 set $platform_class '';
97 if ($arg_platform) {
98 set $platform_class ' class="$arg_platform ua-$arg_user_agent"';
99 }
100 sub_filter ' id="content"' ' id="content"$platform_class';
101
102 fastcgi_pass unix:/tmp/php-fastcgi.sock;
103 fastcgi_index index.php;
104
105 fastcgi_param SCRIPT_FILENAME /var/www/adblockplus.org/phproot$fastcgi_scrip t_name;
106
107 fastcgi_param QUERY_STRING $query_string;
108 fastcgi_param REQUEST_METHOD $request_method;
109 fastcgi_param CONTENT_TYPE $content_type;
110 fastcgi_param CONTENT_LENGTH $content_length;
111
112 fastcgi_param SCRIPT_NAME $fastcgi_script_name;
113 fastcgi_param REQUEST_URI $request_uri;
114 fastcgi_param DOCUMENT_URI $document_uri;
115 fastcgi_param DOCUMENT_ROOT $document_root;
116 fastcgi_param SERVER_PROTOCOL $server_protocol;
117
118 fastcgi_param GATEWAY_INTERFACE CGI/1.1;
119 fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
120
121 fastcgi_param REMOTE_ADDR $remote_addr;
122 fastcgi_param REMOTE_PORT $remote_port;
123 fastcgi_param SERVER_ADDR $server_addr;
124 fastcgi_param SERVER_PORT $server_port;
125 fastcgi_param SERVER_NAME $server_name;
126 }
127 }
OLDNEW

Powered by Google App Engine
This is Rietveld