server { listen 80; listen 443 ssl http2; server_name %HOSTS%; root %ROOT%; index index.html; rewrite ^/(.*)(/|/index|\.html)$ /$1 permanent; location / { try_files $uri $uri.html $uri/index.html /404; } }