-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf
109 lines (81 loc) · 2.81 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
103
104
105
106
107
108
109
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=tonxy:100m inactive=60m;
server {
listen 80;
server_name tonxy.pro;
server_name *.tonxy.pro;
access_log off;
error_log off;
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl http2;
server_name tonxy.pro;
charset utf-8;
ssl_certificate /etc/letsencrypt/live/tonxy.pro/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/tonxy.pro/privkey.pem;
access_log off;
error_log off;
location / {
proxy_pass http://localhost:8000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
server {
listen 8443 ssl;
server_name in.tonxy.pro;
ssl_certificate /etc/letsencrypt/live/tonxy.pro/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/tonxy.pro/privkey.pem;
access_log off;
error_log off;
location / {
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 Accept-Encoding "";
proxy_pass http://in1.ton.org:8080;
}
}
server {
listen 443 ssl http2;
server_name ~^(?<subdomain>.+)\.tonxy\.pro$;
charset utf-8;
root /srv/http/tonxy.pro;
ssl_certificate /etc/letsencrypt/live/tonxy.pro/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/tonxy.pro/privkey.pem;
access_log off;
error_log off;
set $skip_cache 0;
if ($http_cookie ~* "nginx_no_cache|PHPSESSID") {
set $skip_cache 1;
}
if ($request_uri ~* "/ping|/metrics|/nginx_status|/admin|/#|/feed|sitemap(_index)?.xml") {
set $skip_cache 1;
}
location / {
subs_filter http://(\w*).ton http://$1.tonxy.pro ir;
subs_filter_types text/css text/javascript application/json application/javascript;
proxy_set_header Host "${subdomain}.ton";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "";
proxy_ignore_headers Expires;
proxy_ignore_headers Cache-Control;
proxy_set_header Cookie "";
proxy_pass http://in1.ton.org:8080;
proxy_cache tonxy;
proxy_cache_convert_head off;
proxy_cache_methods GET HEAD;
proxy_cache_valid 499 502 503 504 10s;
proxy_cache_valid any 10m;
proxy_cache_key $request_method$host$uri$is_args$args;
proxy_no_cache $http_pragma $http_authorization $skip_cache;
proxy_cache_bypass $http_pragma $http_authorization $skip_cache;
add_header X-Proxy-Cache $upstream_cache_status;
}
}