Umi: 希望发布项目为 http://website/abc/def/ ,基于base配置与nginx部署失败的问题

Created on 7 Sep 2018  ·  1Comment  ·  Source: umijs/umi

我希望访问的项目地址为: http://website/abc/def/
所以对项目进行如下修改:

.umirc.js

base: '/abc/def/'

nginx配置如

server {
listen 8060 default_server;
listen [::]:8060 default_server;
server_name localhost;
root /home/deploy/release/antd-admin/1.0.0;
location / {
index index.html;
try_files $uri $uri /index.html;
}
}
server {
listen 4000;
server_name _;
location / {
proxy_pass http://localhost:8060/;
}
}

虽然这样配置的项目访问是正确的。但是这样配置,会占据 http://website/ 这个根地址

我希望再nginx中更新访问地址如下

location /abc/def/

server {
listen 4000;
server_name _;
location /abc/def/ {
xxx;
xxx;}
}

这个时候应该修改哪里?尝试了几种办法,均没有实现~~,求助!!

Most helpful comment

这个问题的核心其实是数据资源映射的问题。增加如下即可

.umirc.js

publicPath: 'https://xaudio-dulife.baidu.com/mgmt/reed/'

>All comments

这个问题的核心其实是数据资源映射的问题。增加如下即可

.umirc.js

publicPath: 'https://xaudio-dulife.baidu.com/mgmt/reed/'

Was this page helpful?
0 / 5 - 0 ratings