同域名同端口通过nginx location转发部署多个前端项目
- 项目编译需要增加二级目录
// react项目 通过配置basename增加二级目录{props.children} // 也可以通过webpack 处理输出 config.output.publicPath = '/h5/';
- nginx配置多location转发
# 项目1
location / {
root /data/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
# 项目2
location /h5 {
alias /data/report-h5/;
index index.html index.htm;
try_files $uri $uri/ /h5/index.html;
}



