const router = new VueRouter({ mode: ‘history‘, base: ‘/dist/‘, routes })
我在本地目录下新建了一个conf.d文件夹,里面创建了一个test.conf文件
server { listen 80; server_name localhost(域名); root E:/vue/prog/nginx-root/dist; -------nginx指向目录 autoindex on; -------------自动锁死在index.html里 index index.html index.htm; charset utf-8; location /api { proxy_pass http://反向代理的地址; } location / { try_files $uri $uri/ /index.html; -----vue官网上的配置,假设路径路由找不到的时候,默认跳转到首页index上 } }
运行start nginx 就可以啦~~~~~~~~
如果本文对您有帮助,请抬抬您的小手,点下右下角的推荐, ^-^,
当然如果看了这篇博客对您有帮助是我最开心的事,毕竟赠人玫瑰,手有余香, ^-^,
如果这篇博客没有帮助到您,那就只能说一声抱歉啦
带二级目录的Nginx配置------目前找到的最简单的方法
原文:https://www.cnblogs.com/katydids/p/9963988.html