nginx 配置 单页面应用的解决方案

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

    gzip_static on;

    location / {

          index index.html;

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

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

      }

}

多么滴easy 啊

 

posted @ 2016-04-13 10:33  janjon  阅读(2735)  评论(0编辑  收藏  举报