server { listen 80; server_name localhost; root /usr/share/nginx/html; index index.html; error_page 404 /404.html; # the app is built with basePath /vocab-quiz; it also works behind a # reverse proxy that removes this prefix rewrite ^/vocab-quiz$ /; rewrite ^/vocab-quiz/(.*)$ /$1; location / { try_files $uri $uri/index.html =404; } }