updated nginx conf for cms
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 42s

This commit is contained in:
2025-06-01 22:30:53 +02:00
parent 2b8b7fa37f
commit e3aec943e0

View File

@@ -1,10 +1,24 @@
server { server {
listen 80; listen 80;
server_name localhost; server_name localhost; # This is fine as Traefik handles the external domain
root /usr/share/nginx/html; 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 / { location / {
index index.html; index index.html; # Serves index.html from directories
try_files $uri $uri/ =404; 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;
} }
} }