赞
踩
http://ip:port 访问 A 项目(vue 项目)
http://ip:port/c 访问 B 项目(vue 项目)
- location / {
- root /usr/local/nginx/html/A/;
- index index.html index.htm;
- }
-
- location /b {
- alias /usr/local/nginx/html/B/;
- index index.html index.htm;
- }
按照上面 2 个步骤配置好访问‘ http://ip:port/b ’是无法访问到 B 项目的静态资源的,需要配置 B 项目的公共资源路径:
vue 项目一般在 vue.config.js 中配置:
- module.exports = {
- // 区分开发和打包分别配置,打包配置的值和nginx配置的保持一致
- publicPath: process.env.NODE_ENV == 'development' ? '/' : '/b',
- }
Nginx 配置修改:
- location / {
- root /www/wwwroot/topfus_research/research_web/;
- try_files $uri $uri/ /index.html;
- }
-
- location /admin {
- alias /www/wwwroot/topfus_research/research_ui/;
- try_files $uri $uri/ /index.html;
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。