Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nginx配置多个vue项目 #40

Open
chenyinkai opened this issue Apr 18, 2018 · 3 comments
Open

nginx配置多个vue项目 #40

chenyinkai opened this issue Apr 18, 2018 · 3 comments
Labels

Comments

@chenyinkai
Copy link
Owner

chenyinkai commented Apr 18, 2018

nginx配置多个vue项目

需求

nginx 下配置多个 vue 项目,或者说非根目录下的配置

举例:

  • blog: https://www.yoursite.com/blog
  • test: https://www.yoursite.com/test

vue项目中配置

vue-router 设置 base 路径

base: '/blog'

config/index.js 修改 assetsPublicPath

assetsPublicPath: '/blog/'

nginx配置

location /blog {
  try_files $uri $uri/ /blog/index.html;
}
@hu949277923
Copy link

location /blog {
try_files $uri $uri/ /blog/index.html;
}
location /test {
try_files $uri $uri/ /test/index.html;
}
不是这样配置么???

@chenyinkai
Copy link
Owner Author

@hu949277923 额,有区别吗? testblog 一样就没写了

@feng138168
Copy link

有没有试过不需要每个新项目都去添加nginx配置的方式

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants