Update nginx.conf
Browse files- nginx.conf +49 -9
nginx.conf
CHANGED
@@ -1,10 +1,31 @@
|
|
1 |
-
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
}
|
6 |
|
7 |
http {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
# 禁用 admin 接口和日志输出
|
9 |
server {
|
10 |
listen 3001;
|
@@ -13,18 +34,37 @@ http {
|
|
13 |
rewrite ^/ai/v1/(.*)$ /v1/$1 break;
|
14 |
proxy_pass http://127.0.0.1:3000;
|
15 |
proxy_set_header Host $host;
|
16 |
-
|
17 |
-
|
18 |
-
proxy_set_header X-Forwarded-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
}
|
20 |
|
21 |
location / {
|
22 |
proxy_pass http://127.0.0.1:3000;
|
23 |
proxy_set_header Host $host;
|
24 |
-
|
25 |
-
|
26 |
-
proxy_set_header X-Forwarded-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
}
|
|
|
|
|
|
|
|
|
|
|
28 |
}
|
29 |
|
30 |
# 禁用错误日志输出
|
|
|
1 |
+
worker_processes auto;
|
2 |
|
3 |
+
worker_rlimit_nofile 65535;
|
4 |
+
|
5 |
+
events {
|
6 |
+
worker_connections 65535;
|
7 |
+
|
8 |
+
multi_accept on;
|
9 |
+
|
10 |
+
use epoll;
|
11 |
}
|
12 |
|
13 |
http {
|
14 |
+
|
15 |
+
# 连接超时设置
|
16 |
+
keepalive_timeout 120;
|
17 |
+
keepalive_requests 100;
|
18 |
+
|
19 |
+
# 压缩设置
|
20 |
+
gzip on;
|
21 |
+
gzip_vary on;
|
22 |
+
gzip_proxied any;
|
23 |
+
gzip_comp_level 6;
|
24 |
+
gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml;
|
25 |
+
|
26 |
+
# MIME类型
|
27 |
+
include /etc/nginx/mime.types;
|
28 |
+
|
29 |
# 禁用 admin 接口和日志输出
|
30 |
server {
|
31 |
listen 3001;
|
|
|
34 |
rewrite ^/ai/v1/(.*)$ /v1/$1 break;
|
35 |
proxy_pass http://127.0.0.1:3000;
|
36 |
proxy_set_header Host $host;
|
37 |
+
|
38 |
+
# 清除-敏感头部
|
39 |
+
proxy_set_header X-Forwarded-For "";
|
40 |
+
proxy_set_header X-Real-IP "";
|
41 |
+
proxy_set_header X-Direct-Url "";
|
42 |
+
proxy_set_header X-Forwarded-Port "";
|
43 |
+
proxy_set_header X-Ip-Token "";
|
44 |
+
proxy_set_header X-Request-Id "";
|
45 |
+
proxy_set_header X-Amzn-Trace-Id "";
|
46 |
+
proxy_set_header X-Forwarded-Proto "";
|
47 |
}
|
48 |
|
49 |
location / {
|
50 |
proxy_pass http://127.0.0.1:3000;
|
51 |
proxy_set_header Host $host;
|
52 |
+
|
53 |
+
# 清除-敏感头部
|
54 |
+
proxy_set_header X-Forwarded-For "";
|
55 |
+
proxy_set_header X-Real-IP "";
|
56 |
+
proxy_set_header X-Direct-Url "";
|
57 |
+
proxy_set_header X-Forwarded-Port "";
|
58 |
+
proxy_set_header X-Ip-Token "";
|
59 |
+
proxy_set_header X-Request-Id "";
|
60 |
+
proxy_set_header X-Amzn-Trace-Id "";
|
61 |
+
proxy_set_header X-Forwarded-Proto "";
|
62 |
}
|
63 |
+
|
64 |
+
# 429 错误-页面
|
65 |
+
location = /429.html {
|
66 |
+
return 429 'Too Many Requests';
|
67 |
+
}
|
68 |
}
|
69 |
|
70 |
# 禁用错误日志输出
|