server { listen 80; server_name localhost; # This is fine as Traefik handles the external domain root /usr/share/nginx/html; # Specific location for the Decap CMS admin panel # This ensures that any request to /admin/ or /admin/* (that isn't an existing file/dir) # serves /admin/index.html, allowing Decap's client-side router to work. location /admin/ { try_files $uri $uri/ /admin/index.html; } # General location block for the rest of your site location / { index index.html; # Serves index.html from directories try_files $uri $uri/ =404; # Returns 404 if file/directory not found. # If your main site is also an SPA, change to: try_files $uri $uri/ /index.html; } # Optional: Deny access to hidden files like .htaccess or .git location ~ /\. { deny all; } }