Bladex 伪静态配置
# 转发接口
location ^~ /api/ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
rewrite ^/api/(.*)$ /$1 break;
proxy_pass http://127.0.0.1:端口号/;
}
# 本地存储
location ^~ /images/ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
rewrite ^/images/(.*)$ /images/$1 break;
proxy_pass http://127.0.0.1:端口号/images/;
}
# 确保后端页面的处理
location /admin {
try_files $uri $uri/ /admin/index.html;
}
# 前端页面的的处理
location / {
try_files $uri $uri/ /index.html;
}
Bladex 设置配置文件
--spring.profiles.active=prod
若依伪静态配置
# 后端转发接口
location /prod-api/ {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:端口号/;
}
# 前端转发接口
location /api/ {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:端口号/;
}
# 确保后端页面的处理
location /manager {
try_files $uri $uri/ /manager/index.html;
}
# 前端页面的的处理 如果后端没有后缀 则用这条
location / {
try_files $uri $uri/ /index.html;
}