vue history模式nginx配置

項目位於base下的h5文件夾中。 

 對應nginx配置

server {
        listen       8080;
        server_name 0.0.0.0;
        location /h5 {
            root C:/base;
            index index.html;
            //下面這個是history配置關鍵
            try_files $uri $uri/ /h5/index.html;
        }
        location @router {
            rewrite ^.*$ /index.html last;
        }
    }

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章