一、该问题的重现步骤是什么?
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)
- 热议问题
-
验证码如何限制只有数字
1
-
组态数据过滤器data显示为null
1
-
cloud项目运行启动报错
1
-
物联网平台的防注入代码在哪
1
-
漏洞:越权
2
-
升级最新版代码后,使用代码生成功能报错
1
-
broker模块如何设置用mqtt协议连接
1
-
saber3 4.6版本无法启动问题
1
-
物理模型设置参数时操作失败,如何设置监听topic?
1
-
nacos 配置两个数据源,我在项目引入最新的redis配置 但是不生效;请问什么原因;
2
扫一扫访问 Blade技术社区 移动端