-
Notifications
You must be signed in to change notification settings - Fork 2
/
oab_nginx
287 lines (262 loc) · 9.34 KB
/
oab_nginx
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
# REDIRECTS - EVERYTHING TO HTTPS AND NO WWW
server {
listen 80;
server_name teambutton.org *.teambutton.org;
return 301 https://openaccessbutton.org$request_uri?team=true;
}
server {
listen 443 ssl;
server_name teambutton.org *.teambutton.org;
return 301 https://openaccessbutton.org$request_uri?team=true;
}
server {
listen 80;
server_name opendatabutton.org *.opendatabutton.org;
return 301 https://openaccessbutton.org$request_uri?odb=true;
}
server {
listen 443 ssl;
server_name opendatabutton.org *.opendatabutton.org;
return 301 https://openaccessbutton.org$request_uri?odb=true;
}
server {
listen 80;
server_name api.openaccessbutton.org;
return 301 https://api.openaccessbutton.org$request_uri;
}
server {
listen 80;
server_name www.openaccessbutton.org;
return 301 https://openaccessbutton.org$request_uri;
}
server {
listen 80;
server_name openaccessbutton.org;
return 301 https://openaccessbutton.org$request_uri;
}
server {
listen 443 ssl;
server_name www.openaccessbutton.org;
return 301 https://openaccessbutton.org;
ssl on;
ssl_certificate /etc/letsencrypt/live/www.openaccessbutton.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.openaccessbutton.org/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
ssl_prefer_server_ciphers on;
ssl_stapling on;
add_header Strict-Transport-Security "max-age=31536000;";
location ^~ /.well-known/acme-challenge/ {
default_type "text/plain";
root /var/www/letsencrypt;
}
location = /.well-known/acme-challenge/ {
return 404;
}
}
server {
listen 80;
server_name blog.openaccessbutton.org;
return 301 https://oabutton.ghost.io$request_uri;
}
server {
listen 443 ssl;
server_name blog.openaccessbutton.org;
return 301 https://oabutton.ghost.io$request_uri;
}
server {
listen 443;
server_name openaccessbutton.org;
root /home/cloo/live/openresearchbutton/website;
ssl on;
ssl_certificate /etc/letsencrypt/live/openaccessbutton.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/openaccessbutton.org/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
ssl_prefer_server_ciphers on;
ssl_stapling on;
add_header Strict-Transport-Security "max-age=31536000;";
location ^~ /.well-known/acme-challenge/ {
default_type "text/plain";
root /var/www/letsencrypt;
}
location = /.well-known/acme-challenge/ {
return 404;
}
add_header Pragma public;
add_header Cache-Control "public";
add_header Access-Control-Allow-Origin *;
rewrite ^/requests /request;
rewrite ^/request/.*$ /request/item last;
rewrite ^/response/.*$ /response/item last;
rewrite ^/dnr/.*$ /dnr/item last;
location / {
try_files /serve/$uri /serve/$uri.html /serve/$uri/index.html /serve/404.html =404;
}
location /content {
try_files $uri $uri.html $uri.md $uri/index $uri/index.html $uri/index.md =404;
}
location /static {
try_files /serve/$uri $uri =404;
expires 30d;
}
location = /instantill_alpha {
rewrite ^/.* https://instantill.org/setup;
}
location = /instantill {
rewrite ^/.* https://instantill.org;
}
location = /shareyourpaper.org {
rewrite ^/.* https://shareyourpaper.org;
}
location /blog {
rewrite ^/.* https://oabutton.ghost.io permanent;
}
location /blog/new-oab-2016 {
rewrite ^/.* https://oabutton.ghost.io/take-action-this-open-access-week-with-the-new-open-access-button-e9372c5cb4aa permanent;
}
location /blog/open-data-button-is-here {
rewrite ^/.* https://oabutton.ghost.io/new-app-helps-researchers-share-data-openly-be59437ed6fa permanent;
}
location /blog/may-major-updates {
rewrite ^/.* https://oabutton.ghost.io/open-data-button-launch-update-fd5d7c4e8a74 permanent;
}
location /blog/open-data-button-beta {
rewrite ^/.* https://oabutton.ghost.io/open-data-button-beta-launching-next-week-for-open-data-day-8ab4d0e222a3 permanent;
}
location /blog/from_open_access_to_open_data {
rewrite ^/.* https://oabutton.ghost.io/the-open-access-button-moves-into-open-data-7752f73f7f16 permanent;
}
location /blog/standwithdiego {
rewrite ^/.* https://oabutton.ghost.io/diego-gomez-stands-trial-for-sharing-research-standwithdiego-7bc1f8fadeab permanent;
}
location /blog/diego-gomez {
rewrite ^/.* https://oabutton.ghost.io/support-diego-gomez-an-update-a0e18d0afb96 permanent;
}
location /blog/opencon2015 {
rewrite ^/.* https://oabutton.ghost.io/opencon-applications-are-open-ff694021d72 permanent;
}
location /blog/annual-report-2014 {
rewrite ^/.* https://oabutton.ghost.io/open-access-button-annual-report-2014-90906c2cf12e permanent;
}
location /blog/jisc2015 {
rewrite ^/.* https://oabutton.ghost.io/support-us-in-the-jisc-supporting-technology-startup-project-bfbeec0b50cd permanent;
}
location /blog/innovator-award {
rewrite ^/.* https://oabutton.ghost.io/open-access-button-founders-honoured-with-sparc-innovator-award-22a57e9f5039 permanent;
}
location /blog/end-year-team-memo {
rewrite ^/.* https://oabutton.ghost.io/open-access-button-annual-report-2014-90906c2cf12e permanent;
}
location /blog/odb-launch-update {
rewrite ^/.* https://oabutton.ghost.io/open-data-button-launch-update-fd5d7c4e8a74 permanent;
}
location /blog/new-apps-find-free-access-to-scientific-and-scholarly-research {
rewrite ^/.* https://oabutton.ghost.io/21-october-2014-631d530eb8ca permanent;
}
location ~ /url/(?<url>.+) {
proxy_pass http://noddy_dev/api/academic/redirect?url=$url;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /doi {
proxy_pass http://noddy/api/academic/redirect/doi;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /pmc {
proxy_pass http://noddy/api/academic/redirect/pmc;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /pmid {
proxy_pass http://noddy/api/academic/redirect/pmid;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /title {
proxy_pass http://noddy/api/academic/redirect/title;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /citation {
proxy_pass http://noddy/api/academic/redirect/citation;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
listen 80;
server_name ineedthisdoi.org;
root /home/cloo/live/openresearchbutton/website/ineedthisdoi;
location /static {
try_files $uri $uri.html $uri/index $uri/index.html 404 /404 =404;
}
location = / {
try_files $uri $uri.html /index.html;
}
location = /index.html {
try_files $uri $uri.html /index.html;
}
location / {
proxy_pass http://noddy/api/academic/redirect;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
# SERVE LIVE API WITH CONNECT TO PREFERRED METEOR SERVICE (CLUSTER)
server {
listen 443 ssl spdy;
server_name api.openaccessbutton.org;
ssl on;
ssl_certificate /etc/letsencrypt/live/api.openaccessbutton.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/api.openaccessbutton.org/privkey.pem;
location /availability {
proxy_pass https://bg.oa.works/availability;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /find {
proxy_pass https://bg.oa.works/find;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /permissions {
proxy_pass https://bg.oa.works/permissions;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ^~ /.well-known/acme-challenge/ {
default_type "text/plain";
root /var/www/letsencrypt;
}
location = /.well-known/acme-challenge/ {
return 404;
}
location / {
proxy_pass http://noddy/api/service/oab/;
add_header Access-Control-Allow-Methods 'GET, PUT, POST, DELETE, OPTIONS';
add_header Access-Control-Allow-Headers 'X-apikey,X-id,DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header X-Forwarded-For $remote_addr;
}
}