Nginx一个端口部署多个前端项目
场景根据路由不一样,在一个端口中,配置多个前端vue项目。配置vue项目打包在vue.config.js中配置如下const isProduction = process.env.NODE_ENV === 'production'module.exports = {....publicPath: isProduction ? './' : '/',}nginx配置server {listen 80
·
场景
根据路由不一样,在一个端口中,配置多个前端vue项目。
配置
- vue项目打包
在vue.config.js
中配置如下const isProduction = process.env.NODE_ENV === 'production' module.exports = { .... publicPath: isProduction ? './' : '/', }
- nginx配置
server { listen 8081; location / { root /opt/dist/vue3-element; index index.html; } location /base { alias /opt/dist/base/; index index.html index.html; } }
- 访问
http://127.0.0.1:8081/ http://127.0.0.1:8081/base/
更多推荐
已为社区贡献4条内容
所有评论(0)