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 啊