-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmaterialgraph.nginx
More file actions
78 lines (64 loc) · 2.62 KB
/
Copy pathmaterialgraph.nginx
File metadata and controls
78 lines (64 loc) · 2.62 KB
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
limit_req_zone $binary_remote_addr zone=materialgraph_expensive:10m rate=2r/s;
limit_conn_zone $binary_remote_addr zone=materialgraph_client:10m;
limit_conn_zone $server_name zone=materialgraph_site:10m;
server {
listen 443 ssl;
server_name materialgraph.org www.materialgraph.org;
server_tokens off;
client_max_body_size 32k;
add_header Strict-Transport-Security "max-age=31536000" always;
limit_req_status 429;
limit_conn_status 429;
limit_req_log_level notice;
limit_conn_log_level notice;
limit_conn materialgraph_site 20;
ssl_certificate /etc/letsencrypt/live/materialgraph.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/materialgraph.org/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
location ~ ^/api/v1/(comparison/materials|scenarios/rank|screening/candidates|sensitivity/material|substitutions/analyze)$ {
limit_req zone=materialgraph_expensive burst=4 nodelay;
limit_conn materialgraph_client 2;
limit_conn materialgraph_site 20;
proxy_pass http://127.0.0.1:8000;
proxy_http_version 1.1;
proxy_connect_timeout 3s;
proxy_send_timeout 10s;
proxy_read_timeout 25s;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
}
location ~ ^/api/v1/materials/[^/]+/(criticality|discovery|neighborhood|neighbors|recommendations|research|similar)(/|$) {
limit_req zone=materialgraph_expensive burst=4 nodelay;
limit_conn materialgraph_client 2;
limit_conn materialgraph_site 20;
proxy_pass http://127.0.0.1:8000;
proxy_http_version 1.1;
proxy_connect_timeout 3s;
proxy_send_timeout 10s;
proxy_read_timeout 25s;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
}
location / {
proxy_pass http://127.0.0.1:8000;
proxy_http_version 1.1;
proxy_connect_timeout 3s;
proxy_send_timeout 10s;
proxy_read_timeout 20s;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
server {
listen 80 default_server;
server_name materialgraph.org www.materialgraph.org;
server_tokens off;
return 301 https://$host$request_uri;
}