2023-04-07 15:48:08 +08:00
|
|
|
server {
|
|
|
|
listen 80;
|
|
|
|
server_name localhost;
|
|
|
|
|
|
|
|
gzip on;
|
|
|
|
gzip_static on; # 需要http_gzip_static_module 模块
|
|
|
|
gzip_min_length 1k;
|
|
|
|
gzip_comp_level 4;
|
|
|
|
gzip_proxied any;
|
|
|
|
gzip_types text/plain text/xml text/css;
|
|
|
|
gzip_vary on;
|
|
|
|
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
|
|
|
|
|
|
|
|
# 前端打包好的dist目录文件
|
|
|
|
root /data/;
|
|
|
|
|
|
|
|
location ^~/api/ {
|
2023-07-07 16:14:05 +08:00
|
|
|
proxy_pass http://pig-gateway:9999/; #注意/后缀
|
2023-04-07 15:48:08 +08:00
|
|
|
proxy_connect_timeout 60s;
|
|
|
|
proxy_read_timeout 120s;
|
|
|
|
proxy_send_timeout 120s;
|
|
|
|
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 http;
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
proxy_set_header Connection "upgrade";
|
|
|
|
proxy_set_header Host $http_host;
|
2024-04-02 12:42:00 +08:00
|
|
|
proxy_set_header from "";
|
2023-04-07 15:48:08 +08:00
|
|
|
}
|
2024-12-15 00:05:59 +08:00
|
|
|
|
|
|
|
# 屏蔽所有敏感路径,不用改代码
|
|
|
|
location ~* ^/(actuator|swagger-ui|v3/api-docs|swagger-resources|webjars|doc.html) {
|
|
|
|
return 403; # 禁止访问
|
|
|
|
}
|
2023-04-07 15:48:08 +08:00
|
|
|
}
|