diff --git a/nginx.conf b/nginx.conf index 36f4bbf..1e61cf3 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,5 +1,5 @@ server { - listen 80 http2; # 启用HTTP/2 + listen 80; gzip on; gzip_min_length 1k; @@ -22,11 +22,6 @@ server { location /api/ { # 此处为后端地址 proxy_pass ${BACK_API}; - # 添加一些安全设置 - include proxy_params; - 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; } # 添加安全头设置 @@ -34,10 +29,6 @@ server { add_header X-Frame-Options "SAMEORIGIN"; add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; frame-ancestors 'none';"; - # 限制请求频率 - limit_req zone=api burst=5 nodelay; - limit_req_status 429; # 限制请求超过后的响应码 - # 防止服务隐藏文件 location ~ /\. { deny all;