nginx 配置访问路径
下面两个 location ,
(1)后面如果是 / ,访问的路径 :
ip:端口/index.html 即可访问到 /usr/share/nginx/html/vue 下面的网页
(2)如果后面有东西,访问的路径:
ip:端口/app/dist/index.html 但是 nginx 找的路径,是:/usr/share/nginx/html/vue/app/dist
是把 app/dist 拼接在 root 下的目录最后面的,而不是前面的
server { listen 80; listen [::]:80; server_name localhost; #access_log /var/log/nginx/host.access.log main; location / { root /usr/share/nginx/html/vue; index index.html index.htm; } location /app/dist/ { root /usr/share/nginx/html/vue; index index.html index.htm; } …… }