forked from fantasticit/think
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf.sample
109 lines (89 loc) · 2.59 KB
/
nginx.conf.sample
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
upstream think_client {
server 127.0.0.1:5001;
keepalive 64;
}
upstream think_server {
server 127.0.0.1:5002;
keepalive 64;
}
upstream think_wss {
server 127.0.0.1:5003;
keepalive 64;
}
server {
listen 80;
server_name api.codingit.cn;
rewrite ^(.*)$ https://$host$1 permanent;
}
server {
listen 443 ssl http2;
server_name api.codingit.cn;
ssl_certificate /apps/ssl/api.codingit.cn/api.codingit.cn.pem;
ssl_certificate_key /apps/ssl/api.codingit.cn/api.codingit.cn.key;
ssl_session_timeout 5m;
client_max_body_size 100m;
location /api {
proxy_pass http://think_server;
proxy_read_timeout 300s;
proxy_send_timeout 300s;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
}
location /think/wss {
proxy_pass http://think_wss;
proxy_read_timeout 300s;
proxy_send_timeout 300s;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
}
location /static/ {
gzip_static on;
expires max;
add_header Cache-Control public;
alias /apps/think/packages/server/static/;
}
}
server {
listen 80;
server_name think.codingit.cn;
rewrite ^(.*)$ https://$host$1 permanent;
}
server {
listen 443 ssl http2;
server_name think.codingit.cn;
ssl_certificate /apps/ssl/think.codingit.cn/think.codingit.cn.pem;
ssl_certificate_key /apps/ssl/think.codingit.cn/think.codingit.cn.key;
ssl_session_timeout 5m;
location / {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header X-Nginx-Proxy true;
proxy_cache_bypass $http_upgrade;
proxy_pass http://think_client;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# 静态文件
location ^~ /_next {
alias /apps/think/packages/client/.next;
autoindex on;
}
# next-pwa 生成的静态文件(service-worker.js, workbox-*.js)
location ~ /*\.js$ {
add_header Content-Type "application/javascript; charset=UTF-8";
root /apps/think/packages/client/.next;
}
# 自定义流程图编辑器的文件
location ~ /*\.(gif|png|jpg|jpeg|xml|txt)$ {
root /apps/think/packages/client/.next;
}
}