解決nginx 部署nginx 刷新頁面404問題

    server {
    listen 80;
    server_name www.tianxiashiguan.com tianxiashiguan.com;
    access_log /data/wwwlogs/access_nginx.log combined;
    root /data/wwwroot/dist/;
    index index.html index.htm index.jsp;
    try_files $uri $uri/ /index.html;//此處解決刷新頁面出現404的問題
    #error_page 404 /404.html;
    #error_page 502 /502.html;
    location /nginx_status {
      stub_status on;
      access_log off;
      allow 127.0.0.1;
      deny all;
    }
  }

在配置文件中添加 try_files $uri $uri/ /index.html;

親測有效!

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