server{
listen 8081;
server_name xx.xx.xx.xx;
set $root_path /var/www/release-web/;
index index.html index.htm;
location / {
root $root_path; # 切换成你的静态资源目录
try_files $uri $uri/ @router;
}
#不在同一端口下 请求后端接口需要反向代理
location /api/ {
proxy_pass http://39.106.64.244/api/;
}
#路由找不到需要这么配
location @router {
rewrite ^.*$ /index.html last;
}
}
nginx配置前端页面
最新推荐文章于 2024-05-24 16:59:37 发布