nginx 配置 單頁面應用的解決方案

server {
    listen 80;
    server_name example.com;
    root /var/www/example.com;

    gzip_static on;

    location / {html

          index index.html;spa

          rewrite ^/.*/$ / last; # Redirect everything to / (ex index.html) and let the JS router take care of the restrest

          rewrite ^([^.]*[^/])$ $1/ permanent; # Force trailing slashcode

      }router

}多麼滴easy 啊
相關文章
相關標籤/搜索