This repository was archived by the owner on Apr 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 68
/
Copy pathnginx-default.conf
305 lines (239 loc) · 9.79 KB
/
nginx-default.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
proxy_cache_path /tmp/nginx-cache keys_zone=legacy:50m;
proxy_cache_path /tmp/nginx-updates-cache keys_zone=updates:50m;
map $http_user_agent $cache_setting {
default 10m;
"~* facebookexternalhit/[0-9]|Twitterbot|Pinterest|Slack|Google.*snippet" -1m;
}
upstream updates {
server 185.203.72.17:443;
}
server {
listen 80;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl default_server;
server_name blockstack.org;
ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem;
ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;
root /usr/share/nginx/html;
index index.html;
add_header X-Frame-Options "DENY";
add_header Referrer-Policy "SAME-ORIGIN";
expires $cache_setting;
rewrite ^/(.*)/$ /$1 permanent;
location / {
try_files $uri $uri/ $uri.html =404;
}
rewrite ^/blog(.*)$ https://blog.blockstack.org$1 permanent;
location /posts/ {
try_files $uri $uri/ /blog/index.html;
}
location /videos/ {
try_files $uri $uri/ /videos/index.html;
}
location /tutorials/ {
try_files $uri $uri/ /tutorials/;
}
# redirects
# What is Blockstack
rewrite ^/docs/blockchain-identity/?$ /try-blockstack permanent;
rewrite ^/docs/blockchain-id/?$ /try-blockstack permanent;
rewrite ^/docs/what-is-blockstack/?$ /try-blockstack permanent;
rewrite ^/what-is-blockstack/?$ /try-blockstack permanent;
# About
rewrite ^/pbc/?$ /about permanent;
# FAQ
rewrite ^/articles/faq/?$ https://docs.blockstack.org/faqs/allfaqs permanent;
rewrite ^/faqs/?$ https://docs.blockstack.org/faqs/allfaqs permanent;
rewrite ^/faq/?$ https://docs.blockstack.org/faqs/allfaqs permanent;
# Funding
rewrite ^/fund/?$ https://signaturefund.org permanent;
rewrite ^/funding/?$ https://signaturefund.org permanent;
# Blog
rewrite ^/articles/?$ /blog permanent;
rewrite ^/posts/?$ /blog permanent;
# Wallet
rewrite ^/wallet/?$ https://wallet.blockstack.org permanent;
rewrite ^/wallet-hash-instructions/?$ https://wallet.blockstack.org permanent;
# Papers
rewrite ^/articles/blockstack-core/?$ /papers permanent;
rewrite ^/articles/light-clients/?$ /papers permanent;
rewrite ^/articles/login-paper/?$ /papers permanent;
rewrite ^/docs/login-paper/?$ /papers permanent;
# PDFs
rewrite ^/docs/how-blockstack-works/?$ /whitepaper.pdf permanent;
rewrite ^/blockstack_whitepaper.pdf$ /whitepaper.pdf permanent;
rewrite ^/blockstack.pdf/?$ /blockstack_usenix16.pdf permanent;
rewrite ^/blockstack-login.pdf/?$ /blockstack_login16.pdf permanent;
rewrite ^/virtualchain.pdf/?$ /virtualchain_dccl16.pdf permanent;
# Misc
rewrite ^/talks/?$ /videos permanent;
rewrite ^/browser/?$ /install permanent;
rewrite ^/articles/browser-beta/?$ /install permanent;
rewrite ^/join/?$ /signup permanent;
rewrite ^/newsletter/?$ /signup permanent;
rewrite ^/users/?$ /signup permanent;
rewrite ^/summit2019/?$ https://community.blockstack.org/summit2019 permanent;
rewrite ^/summit/?$ https://community.blockstack.org/summit2019 permanent;
rewrite ^/bugs/?$ https://community.blockstack.org/bugs permanent;
rewrite ^/devs?/?$ https://community.blockstack.org/developers-getting-started permanent;
rewrite ^/rfds/?$ https://goo.gl/forms/XQHbP6COpEK7mPCy2 permanent;
# Token Related
rewrite ^/tokensale/?$ https://stackstoken.com permanent;
rewrite ^/token/?$ https://stackstoken.com permanent;
# Tutorials
rewrite ^/intro/?$ /try-blockstack permanent;
rewrite ^/tutorials/?$ https://docs.blockstack.org/browser/hello-blockstack.html permanent;
rewrite ^/docs/installation/?$ https://docs.blockstack.org/browser/hello-blockstack.html;
rewrite ^/tutorials/hello-blockstack/?$ https://docs.blockstack.org/browser/hello-blockstack.html permanent;
rewrite ^/tutorials/todo-list/?$ https://docs.blockstack.org/browser/todo-list.html permanent;
rewrite ^/tutorials/todo-spa/?$ https://docs.blockstack.org/browser/todo-list.html permanent;
rewrite ^/tutorials/multi-player-storage/?$ https://docs.blockstack.org/browser/blockstack_storage.html permanent;
rewrite ^/tutorials/hello-world/?$ /tutorials/hello-blockstack permanent;
rewrite ^/docs/installation/?$ https://docs.blockstack.org/browser/hello-blockstack.html permanent;
# Community page redirects
rewrite ^/career-foundry/?$ https://community.blockstack.org/career-foundry permanent;
rewrite ^/evil/?$ https://community.blockstack.org/evil permanent;
rewrite ^/consensus/?$ https://community.blockstack.org/consensus permanent;
rewrite ^/bigwebshow/?$ https://community.blockstack.org/bigwebshow permanent;
rewrite ^/reactfoo/?$ https://community.blockstack.org/reactfoo permanent;
rewrite ^/makermag/?$ https://community.blockstack.org/makermag permanent;
rewrite ^/rubyonrails/?$ https://community.blockstack.org/rubyonrails permanent;
rewrite ^/ftf/?$ https://community.blockstack.org/ftf permanent;
rewrite ^/sedaily/?$ https://community.blockstack.org/sedaily permanent;
rewrite ^/mlh/?$ https://community.blockstack.org/mlh permanent;
rewrite ^/pomp/?$ https://community.blockstack.org/pomp permanent;
# Webflow redirects
rewrite ^/try-blockstack/?$ https://www2.blockstack.org/apps permanent;
if ($http_user_agent ~* "facebookexternalhit/[0-9]|Twitterbot|Pinterest|Slack|Google.*snippet") {
rewrite ^/berlin2018/?$ /berlin-2018.html;
}
# blockstack.org/updates proxies to newsletters.blockstack.org:
location = /updates/q4-2018-updates.pdf {
try_files /static/slides/q4-2018-blockstack-update.pdf =404;
}
location /updates {
proxy_cache updates;
proxy_cache_valid 200 5m;
proxy_set_header Host newsletters.blockstack.org;
proxy_pass https://updates/;
}
location ~ /updates/(?<section>.+) {
proxy_cache updates;
proxy_cache_valid 200 5m;
proxy_set_header Host newsletters.blockstack.org;
proxy_pass https://updates/updates/$section;
}
# legacy routes...
location ~ /(transfer-from-onename-to-browser.pdf) {
proxy_cache legacy;
proxy_cache_valid 200 1h;
proxy_pass http://blockstack-legacy;
}
location ~ /(whitepaper.pdf|virtualchain_dccl16.pdf|blockstack_login16.pdf|blockstack_usenix16.pdf) {
try_files /static/papers/whitepaper.pdf =404;
}
location ~ /(pox.pdf) {
try_files /static/papers/pox.pdf =404;
}
location ~ /(whitepaper-ch.pdf) {
try_files /static/papers/whitepaper-ch.pdf =404;
}
location ~ /(whitepaper-es.pdf) {
try_files /static/papers/whitepaper-es.pdf =404;
}
location ~ /(whitepaper-jp.pdf) {
try_files /static/papers/whitepaper-jp.pdf =404;
}
location ~ /(whitepaper-ko.pdf) {
try_files /static/papers/whitepaper-ko.pdf =404;
}
location ~ /(tokenpaper.pdf) {
try_files /static/papers/tokenpaper.pdf =404;
}
location ~ /(distribution.pdf) {
try_files /static/papers/distribution.pdf =404;
}
location /berlin2018 {
proxy_cache legacy;
proxy_cache_valid 200 1h;
proxy_pass http://blockstack-legacy;
expires -1m;
}
location /berlin-2018.html {
proxy_cache legacy;
proxy_cache_valid 200 1h;
proxy_pass http://blockstack-legacy;
expires -1m;
}
location /summit2017 {
proxy_cache legacy;
proxy_cache_valid 200 1h;
proxy_pass http://blockstack-legacy;
}
location /auth {
proxy_cache legacy;
proxy_cache_valid 200 1h;
proxy_pass http://blockstack-legacy;
}
location /signup {
proxy_cache legacy;
proxy_cache_valid 200 1h;
proxy_pass http://blockstack-legacy;
}
location /images/logos/blockstack-bug.svg {
proxy_cache legacy;
proxy_cache_valid 200 1h;
proxy_pass http://blockstack-legacy;
}
location /images/logos/blockstack-logo-landscape-rev.svg {
proxy_cache legacy;
proxy_cache_valid 200 1h;
proxy_pass http://blockstack-legacy;
}
location ~ /css/(bootstrap.min.css|main.css|font-awesome.min.css|slick.css|sunburst.css|slick-theme.css) {
proxy_cache legacy;
proxy_cache_valid 200 1h;
proxy_pass http://blockstack-legacy;
}
location ~ /css/fonts/(slick.woff|slick.ttf) {
proxy_cache legacy;
proxy_cache_valid 200 1h;
proxy_pass http://blockstack-legacy;
}
location ~ /js/(bootstrap.min.js|highlight.js|tether.min.js|popper.min.js|main.js|jquery.min.js) {
proxy_cache legacy;
proxy_cache_valid 200 1h;
proxy_pass http://blockstack-legacy;
}
location /fonts/fontawesome-webfont.woff2 {
proxy_cache legacy;
proxy_cache_valid 200 1h;
proxy_pass http://blockstack-legacy;
}
location ~ /images/(photos|logos)/blockstack-summit- {
proxy_cache legacy;
proxy_cache_valid 200 1h;
proxy_pass http://blockstack-legacy;
}
location ~ /images/visuals/(summit-placeholder-design.png|blockstack-grid-reverse.svg) {
proxy_cache legacy;
proxy_cache_valid 200 1h;
proxy_pass http://blockstack-legacy;
}
error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
server {
listen 443 ssl;
server_name www.blockstack.org
ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem;
ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;
return 301 https://blockstack.org$request_uri;
}