1、刪除源文件后,配置了gzip,當配置gzip刪除源文件后,解決前端history問題,就會出現所有的都返回html,請求js、css也會返回html,頁面會報錯,如下配置即可
location / { root e:/build; index index.html index.htm; gzip_static on; #查找靜態文件 try_files $uri $uri/ /index.html; #找不到返回html,處理前端history路由模式 } #靜態文件交給nginx處理 location ~* \.(jpg|jpeg|png|gif|css|js|swf|mp3|avi|flv|xml|zip|rar)$ { root e:/build; gzip_static on; }