ai2one / nginx.conf
ltxlong's picture
Update nginx.conf
19b91a4 verified
worker_processes auto;
worker_rlimit_nofile 65535;
events {
worker_connections 65535;
multi_accept on;
use epoll;
}
http {
# 连接超时设置
keepalive_timeout 120;
keepalive_requests 100;
# 压缩设置
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml;
# MIME类型
include /etc/nginx/mime.types;
# 禁用 admin 接口和日志输出
server {
listen 3001;
location /ai/v1/ {
rewrite ^/ai/v1/(.*)$ /v1/$1 break;
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
# 清除-敏感头部
proxy_set_header X-Forwarded-For "";
proxy_set_header X-Real-IP "";
proxy_set_header X-Direct-Url "";
proxy_set_header X-Forwarded-Port "";
proxy_set_header X-Ip-Token "";
proxy_set_header X-Request-Id "";
proxy_set_header X-Amzn-Trace-Id "";
proxy_set_header X-Forwarded-Proto "";
}
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
# 清除-敏感头部
proxy_set_header X-Forwarded-For "";
proxy_set_header X-Real-IP "";
proxy_set_header X-Direct-Url "";
proxy_set_header X-Forwarded-Port "";
proxy_set_header X-Ip-Token "";
proxy_set_header X-Request-Id "";
proxy_set_header X-Amzn-Trace-Id "";
proxy_set_header X-Forwarded-Proto "";
}
# 429 错误-页面
location = /429.html {
return 429 'Too Many Requests';
}
}
# 禁用错误日志输出
error_log /dev/null crit;
}