-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwpt.conf
151 lines (132 loc) · 12.6 KB
/
wpt.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
lua_package_path '/var/lib/ngx_wpt/?.lua;/usr/local/openresty/lualib/?.lua;/usr/local/openresty/lualib/?/init.lua;./?.lua;/usr/local/openresty/luajit/share/luajit-2.1.0-alpha/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;/usr/local/openresty/luajit/share/lua/5.1/?.lua;/usr/local/openresty/luajit/share/lua/5.1/?/init.lua';
lua_shared_dict hosts 1m;
init_worker_by_lua_file /var/lib/ngx_wpt/init.lua;
server {
listen 80;
#webpagetest rewrite rules
rewrite ^/about$ /about.php last;
rewrite ^/traceroute$ /traceroute.php last;
rewrite ^/mobile$ /mobile.php last;
rewrite ^/tips$ /tips.php last;
rewrite ^/pss$ /pss.php last;
rewrite ^/compare$ /pss.php last;
rewrite ^/blink$ /blink.php last;
#result paths
rewrite ^/result/([a-zA-Z0-9_]+)$ /result/$1/ permanent;
rewrite ^/result/([a-zA-Z0-9_]+)/$ /results.php?test=$1 last;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/waterfall$ /result/$1/$2/details/ permanent;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/waterfall/$ /result/$1/$2/details/ permanent;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/details$ /details.php?test=$1&run=$2 last;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/details/$ /details.php?test=$1&run=$2 last;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/waterfall/cached$ /result/$1/$2/details/cached/ permanent;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/waterfall/cached/$ /result/$1/$2/details/cached/ permanent;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/details/cached$ /details.php?test=$1&run=$2&cached=1 last;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/details/cached/$ /details.php?test=$1&run=$2&cached=1 last;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/optimization$ /result/$1/$2/performance_optimization/ permanent;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/optimization/$ /result/$1/$2/performance_optimization/ permanent;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/performance_optimization$ /performance_optimization.php?test=$1&run=$2 last;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/performance_optimization/$ /performance_optimization.php?test=$1&run=$2 last;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/optimization/cached$ /result/$1/$2/performance_optimization/cached/ permanent;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/optimization/cached/$ /result/$1/$2/performance_optimization/cached/ permanent;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/performance_optimization/cached$ /performance_optimization.php?test=$1&run=$2&cached=1 last;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/performance_optimization/cached/$ /performance_optimization.php?test=$1&run=$2&cached=1 last;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/screen_shot$ /screen_shot.php?test=$1&run=$2 last;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/screen_shot/$ /screen_shot.php?test=$1&run=$2 last;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/screen_shot/cached$ /screen_shot.php?test=$1&run=$2&cached=1 last;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/screen_shot/cached/$ /screen_shot.php?test=$1&run=$2&cached=1 last;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/breakdown$ /breakdown.php?test=$1&run=$2 last;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/breakdown/$ /breakdown.php?test=$1&run=$2 last;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/breakdown/cached$ /breakdown.php?test=$1&run=$2&cached=1 last;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/breakdown/cached/$ /breakdown.php?test=$1&run=$2&cached=1 last;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/domains$ /domains.php?test=$1&run=$2 last;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/domains/$ /domains.php?test=$1&run=$2 last;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/domains/cached$ /domains.php?test=$1&run=$2&cached=1 last;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/domains/cached/$ /domains.php?test=$1&run=$2&cached=1 last;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/optimization_report$ /optimization_report.php?test=$1&run=$2 last;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/optimization_report/$ /optimization_report.php?test=$1&run=$2 last;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/optimization_report/cached$ /optimization_report.php?test=$1&run=$2&cached=1 last;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/optimization_report/cached/$ /optimization_report.php?test=$1&run=$2&cached=1 last;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/pagespeed$ /pagespeed.php?test=$1&run=$2 last;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/pagespeed/$ /pagespeed.php?test=$1&run=$2 last;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/pagespeed/cached$ /pagespeed.php?test=$1&run=$2&cached=1 last;
rewrite ^/result/([a-zA-Z0-9_]+)/([a-zA-Z0-9]+)/pagespeed/cached/$ /pagespeed.php?test=$1&run=$2&cached=1 last;
rewrite ^/testlog/([0-9]+)$ /testlog/$1/ permanent;
rewrite ^/testlog/([0-9]+)/$ /testlog.php?days=$1 last;
rewrite ^/xmlResult/([a-zA-Z0-9_]+)/$ /xmlResult.php?test=$1 last;
rewrite ^/testlog.csv /testlog.php?f=csv last;
rewrite ^/waterfall.png /waterfall.php last;
#old direct path to images
rewrite ^/results/([a-zA-Z0-9])([a-zA-Z0-9]+)/([a-zA-Z0-9_]+).png$ /results/old/_$1/$1$2/$3.png last;
rewrite ^/results/([a-zA-Z0-9])([a-zA-Z0-9]+)/([a-zA-Z0-9_]+).jpg$ /results/old/_$1/$1$2/$3.jpg last;
rewrite ^/results/old/_([a-zA-Z0-9])/([a-zA-Z0-9]+)/([a-zA-Z0-9_]+).png$ /results/old/$2/$3.png last;
#csv combined results
rewrite ^/result/([a-zA-Z0-9_]+)/.*page_data.csv$ /csv.php?test=$1 last;
rewrite ^/result/([a-zA-Z0-9_]+)/.*requests.csv$ /csv.php?test=$1&requests=1 last;
#thumbnails
rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)_screen_thumb.jpg$ /thumbnail.php?test=$1&run=$2&file=$2_screen.jpg last;
rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)_Cached_screen_thumb.jpg$ /thumbnail.php?test=$1&run=$2&cached=1&file=$2_Cached_screen.jpg last;
rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)_waterfall_thumb.png$ /thumbnail.php?test=$1&run=$2&file=$2_waterfall.png last;
rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)_Cached_waterfall_thumb.png$ /thumbnail.php?test=$1&run=$2&cached=1&file=$2_Cached_waterfall.png last;
rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)_optimization_thumb.png$ /thumbnail.php?test=$1&run=$2&file=$2_optimization.png last;
rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)_Cached_optimization_thumb.png$ /thumbnail.php?test=$1&run=$2&cached=1&file=$2_Cached_optimization.png last;
#old direct thumbnail paths
rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_screen_thumb.jpg$ /thumbnail.php?test=$1&run=$2&file=$2_screen.jpg last;
rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_Cached_screen_thumb.jpg$ /thumbnail.php?test=$1&run=$2&cached=1&file=$2_Cached_screen.jpg last;
rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_waterfall_thumb.png$ /thumbnail.php?test=$1&run=$2&file=$2_waterfall.png last;
rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_Cached_waterfall_thumb.png$ /thumbnail.php?test=$1&run=$2&cached=1&file=$2_Cached_waterfall.png last;
rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_optimization_thumb.png$ /thumbnail.php?test=$1&run=$2&file=$2_optimization.png last;
rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_Cached_optimization_thumb.png$ /thumbnail.php?test=$1&run=$2&cached=1&file=$2_Cached_optimization.png last;
rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_waterfall_thumb.gif$ /thumbnail.php?test=$1&run=$2&file=$2_waterfall.gif last;
rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_Cached_waterfall_thumb.gif$ /thumbnail.php?test=$1&run=$2&cached=1&file=$2_Cached_waterfall.gif last;
rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_optimization_thumb.gif$ /thumbnail.php?test=$1&run=$2&file=$2_optimization.gif last;
rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_Cached_optimization_thumb.gif$ /thumbnail.php?test=$1&run=$2&cached=1&file=$2_Cached_optimization.gif last;
# waterfalls
rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_waterfall.png$ /waterfall.php?test=$1&run=$2 last;
rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_Cached_waterfall.png$ /waterfall.php?test=$1&run=$2&cached=1 last;
rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_waterfall.gif$ /waterfall.php?test=$1&run=$2 last;
rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_Cached_waterfall.gif$ /waterfall.php?test=$1&run=$2&cached=1 last;
rewrite ^/results/([0-9][0-9])/([0-9][0-9])/([0-9][0-9])/([a-zA-Z0-9_]+)/([0-9]+)_waterfall.png$ /waterfall.php?test=$1$2$3_$4&run=$5 last;
rewrite ^/results/([0-9][0-9])/([0-9][0-9])/([0-9][0-9])/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([0-9]+)_waterfall.png$ /waterfall.php?test=$1$2$3_$4_$5&run=$6 last;
rewrite ^/results/([0-9][0-9])/([0-9][0-9])/([0-9][0-9])/([a-zA-Z0-9_]+)/([0-9]+)_Cached_waterfall.png$ /waterfall.php?test=$1$2$3_$4&run=$5&cached=1 last;
rewrite ^/results/([0-9][0-9])/([0-9][0-9])/([0-9][0-9])/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([0-9]+)_Cached_waterfall.png$ /waterfall.php?test=$1$2$3_$4_$5&run=$6&cached=1 last;
rewrite ^/results/([0-9][0-9])/([0-9][0-9])/([0-9][0-9])/([a-zA-Z0-9_]+)/([0-9]+)_connection.png$ /waterfall.php?test=$1$2$3_$4&run=$5&type=connection last;
rewrite ^/results/([0-9][0-9])/([0-9][0-9])/([0-9][0-9])/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([0-9]+)_connection.png$ /waterfall.php?test=$1$2$3_$4_$5&run=$6&type=connection last;
rewrite ^/results/([0-9][0-9])/([0-9][0-9])/([0-9][0-9])/([a-zA-Z0-9_]+)/([0-9]+)_Cached_connection.png$ /waterfall.php?test=$1$2$3_$4&run=$5&cached=1&type=connection last;
rewrite ^/results/([0-9][0-9])/([0-9][0-9])/([0-9][0-9])/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([0-9]+)_Cached_connection.png$ /waterfall.php?test=$1$2$3_$4_$5&run=$6&cached=1&type=connection last;
# optimization checklists
rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_optimization.png$ /optimizationChecklist.php?test=$1&run=$2 last;
rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_Cached_optimization.png$ /optimizationChecklist.php?test=$1&run=$2&cached=1 last;
rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_optimization.gif$ /optimizationChecklist.php?test=$1&run=$2 last;
rewrite ^/results/old/([a-zA-Z0-9_]+)/([0-9]+)_Cached_optimization.gif$ /optimizationChecklist.php?test=$1&run=$2&cached=1 last;
rewrite ^/results/([0-9][0-9])/([0-9][0-9])/([0-9][0-9])/([a-zA-Z0-9_]+)/([0-9]+)_optimization.png$ /optimizationChecklist.php?test=$1$2$3_$4&run=$5 last;
rewrite ^/results/([0-9][0-9])/([0-9][0-9])/([0-9][0-9])/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([0-9]+)_optimization.png$ /optimizationChecklist.php?test=$1$2$3_$4_$5&run=$6 last;
rewrite ^/results/([0-9][0-9])/([0-9][0-9])/([0-9][0-9])/([a-zA-Z0-9_]+)/([0-9]+)_Cached_optimization.png$ /optimizationChecklist.php?test=$1$2$3_$4&run=$5&cached=1 last;
rewrite ^/results/([0-9][0-9])/([0-9][0-9])/([0-9][0-9])/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([0-9]+)_Cached_optimization.png$ /optimizationChecklist.php?test=$1$2$3_$4_$5&run=$6&cached=1 last;
#location cookie dropping
rewrite ^/loc/([a-zA-Z0-9_]+)$ /util/setloc.php?location=$1 last;
rewrite ^/loc/([a-zA-Z0-9_]+)$/ /util/setloc.php?location=$1 last;
#gzip compressed text result files
rewrite ^/results/([0-9][0-9])/([0-9][0-9])/([0-9][0-9])/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+).(txt|csv)$ /gettext.php?test=$1$2$3_$4&file=$5.$6 last;
rewrite ^/results/([0-9][0-9])/([0-9][0-9])/([0-9][0-9])/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+).(txt|csv)$ /gettext.php?test=$1$2$3_$4_$5&file=$6.$7 last;
#tcpdump capture files
rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+).cap$ /getgzip.php?test=$1&file=$2.cap last;
rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)_Cached.cap$ /getgzip.php?test=$1&file=$2_Cached.cap last;
#page speed
rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)_pagespeed.txt$ /getgzip.php?test=$1&file=$2_pagespeed.txt last;
rewrite ^/result/([a-zA-Z0-9_]+)/([0-9]+)_Cached_pagespeed.txt$ /getgzip.php?test=$1&file=$2_Cached_pagespeed.txt last;
#embeddable video widget
rewrite ^/video/embed/([a-zA-Z0-9_]+)$ /video/view.php?embed=1&id=$1 last;
#widgets
rewrite ^/widgets/pagespeed/tree$ /widgets/pagespeed/tree.php last;
#old pages that were eliminated in the UI rewrite
rewrite ^/test$ / permanent;
# software update checks (to allow for rate limiting agents that go out of control)
rewrite ^/installers/software.dat$ /check_installer.php?installer=software.dat last;
rewrite ^/installers/browsers/([-_a-zA-Z0-9]+\.dat)$ /check_installer.php?installer=browsers%2F$1 last;
location / {
default_type text/plain;
set $target '';
access_by_lua_file /var/lib/ngx_wpt/router.lua;
proxy_pass http://$target;
}
}