server { listen 80; server_name localhost; # Path to the root of our single-page application root /usr/share/nginx/html; index index.html; location / { # First, try to serve the requested file ($uri), # then a directory ($uri/), # and if that fails, fall back to serving index.html. # This is the key for making client-side routing work. try_files $uri $uri/ /index.html; } }