forked from alcorexchange/alcor-ui
-
Notifications
You must be signed in to change notification settings - Fork 2
/
nginx.conf
102 lines (83 loc) · 2.63 KB
/
nginx.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
events
{
}
http
{
proxy_cache_path /var/cache/nginx/alcor levels=1:2 keys_zone=alcor:1m max_size=1g inactive=60m use_temp_path=off;
limit_conn_zone $http_cf_connecting_ip zone=addr:10m;
limit_req_zone $http_cf_connecting_ip zone=ip:10m rate=3r/s;
map $sent_http_content_type $expires
{
"text/html" epoch;
"text/html; charset=utf-8" epoch;
default off;
}
server
{
listen 80;
listen [::]:80;
limit_conn addr 100;
gzip on;
gzip_types text/plain application/xml text/css application/javascript;
gzip_min_length 1000;
location /api
{
# DDOS
limit_req zone=ip burst=12 delay=8;
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;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 1m;
proxy_connect_timeout 1m;
proxy_pass http://host.docker.internal:7001/api;
# kill cache
add_header Last-Modified $date_gmt;
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
if_modified_since off;
expires off;
etag off;
# CORS
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
}
location ~* \.io
{
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy false;
proxy_pass http://host.docker.internal:7001;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /
{
proxy_cache_bypass $http_upgrade;
proxy_cache_key "$host$request_uri";
proxy_cache alcor;
proxy_cache_revalidate on;
proxy_cache_valid 200 2m;
proxy_cache_min_uses 3;
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
proxy_cache_background_update on;
proxy_cache_lock on;
expires $expires;
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;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_connect_timeout 1m;
proxy_pass http://host.docker.internal:7000;
# wss try
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400;
}
}
}