一、该问题的重现步骤是什么?
1. Nginx默认启动在80端口,saber 打包后,部署到Nginx的html/hyx
2. 访问 http://localhost/hyx, 一直显示正在加载资源,F12查看,加载的css,js等资源从html根目录加载
3. 修改Nginx配置文件,增加监听8000,其伺服目录为html/saber,配置api代理接口到https://saber.bladex.cn/api 访问 http://localhost:8000 页面访问成功,登录成功
配置如下:
server {
listen 8000;
server_name localhost;
location / {
root html/hyx;
index index.html index.htm;
}
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;
proxy_buffering off;
rewrite ^/api/(.*)$ /$1 break;
proxy_pass https://saber.bladex.cn/api;
}
}
二、你期待的结果是什么?实际看到的又是什么?
nginx只监听80端口,saber 打包后,部署到Nginx的html/hyx, 通过二级目录方式http://localhost/hyx 可以直接访问登录。
但是http://localhost/hyx 仍然访问不了!
三、你正在使用的是什么产品,什么版本?在什么操作系统上?
saber,在win7上打包编译,部署也是win7系统上,对接的后台是官方后台api,用于测试。
在文件vue.config.js 增加 publicPath: '' 即可,打包后随便部署nginx子目录。
module.exports = { publicPath: '', //默认是'/' ...... }
参考 https://cli.vuejs.org/zh/config/#publicpath
讨论(0)
- 热议问题
-
API报文加密,返回前端数据未使用全局ObjectMapper处理导致数据精度丢失
1
-
大模型平台对话流程编排怎么实现
1
-
mqtt调试支持mqtt协议
1
-
mqtt客户端报错
2
-
设备模拟器未开启成功
1
-
device-simulator启动显示离线状态
2
-
关于多租户分库分表拆问题
1
-
数据大屏 对接权限系统 好搞么
1
-
mvn clean报错
1
-
请问时间控件如何改为24小时制
1
扫一扫访问 Blade技术社区 移动端