Files
hugoblog/nginx.conf
Benno Lorenz e3aec943e0
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 42s
updated nginx conf for cms
2025-06-01 22:30:53 +02:00

25 lines
890 B
Nginx Configuration File

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;
}
}