Files
MER-2.2_2601/mer_plat_admin/nginx-example.conf
2026-03-08 20:07:52 +08:00

35 lines
1.2 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Nginx 示例:部署 npm run build:prod 后的 dist 目录
# 将本文件复制到服务器,修改 root 路径和 server_name 后 include 或替换站点配置
server {
listen 80;
server_name jfplat.suzhouyuqi.com;
# 重要root 必须指向「包含 index.html 和 static 目录」的目录(即整个 dist
# 例如部署到 /var/www/jfplat 时,应把 dist 里的内容放到该目录:
# index.html 在 /var/www/jfplat/index.html
# static/ 在 /var/www/jfplat/static/
root /var/www/jfplat;
index index.html;
# 先尝试作为文件,再作为目录,最后回退到 index.htmlSPA 路由)
location / {
try_files $uri $uri/ /index.html;
}
# 可选:静态资源缓存
location /static/ {
expires 7d;
add_header Cache-Control "public, immutable";
}
# 可选API 反向代理(若前端直接请求同域 api
# location /api/ {
# proxy_pass http://jfplatapi.suzhouyuqi.com;
# proxy_set_header Host $host;
# 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;
# }
}