一、该问题的重现步骤是什么?
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)
官方新品
- 热议问题
-
bladexBoot4.5,按照开发手册配置多数据源报错
1
-
初次登录之后如何关联用户如何重新刷新
1
-
物联网历史数据接口时间数组传参数问题
1
-
自定义弹出框,多次弹出时弹出框内残留上一次的下拉框数据
2
-
Token增加器的使用为空问题
1
-
Invalid bound statement
1
-
生产环境启动成功后服务自动停止
1
-
只要系统抛了异常,系统就会出现跨域的提示
1
-
skywalking的log页块下没有日志数据
1
-
rider中 使用127.0.0.1访问正常,用域名访问就跨域,一般是哪里设置不对
1
扫一扫访问 Blade技术社区 移动端