vue部署访问单页面404问题

vue单页面的启动页面是index.html,路由的路径实际是不存在的,所以会出现访问单页面404问题,需要设置所有找不到的路径直接映射到index.html

		root D:/nginx-0.8.55/html/dist/;
		index  index.html index.htm;
		
        location / {
			try_files $uri $uri @router;
			index index.html;
        }
		
		location @router {
			rewrite ^.*$ /index.html last;
		}
		location /api/ {
			proxy_pass http://192.168.8.133:8090/api/;
		}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章