使用nginx域名转发
1. 后台接口以/api开头
2.nginx检测api开头,转到后台应用
3.配置示例
# 刷新页面404
location / {
try_files $uri $uri/ /index.html;
}
# 转发域名
location /api/ {
proxy_pass http://axxx;
}
# 访问静态资源
location ^~ /upload/ {
expires 30d;
autoindex on;
add_header Cache-Control private;
alias /var/upload/;
}