server { listen 80 default_server; root /config/www; index index.html; server_name _; client_max_body_size 0; location / { if ($request_uri ~ ^/(.*)\.html) { return 302 /$1; } try_files $uri $uri.html $uri/ =404; } error_page 404 /404-error.html; }