server {
listen 80;
server_name localhost;
access_log logs/test.log main;
# 忽略请求头带下划线的参数名
underscores_in_headers on;
# 前端项目
location / {
root /home/admin/web/test/dist;
index index.html index.htm;
proxy_http_version 1.1;
add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate";
try_files $uri $uri/ /index.html;
}
# 后端项目
location /test {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-Ip $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_http_version 1.1;
add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate";
client_max_body_size 3000m;
}
}