Spaces:
Running

webmag-kit / nginx.conf
Flubstar's picture
Nginx-Vorlage mit Gzip + Cache-Headern
8e99e1b verified
Raw History Blame Contribute Delete
1.1 kB
# WebMag Kit — Nginx-Vorlage
# Nach /etc/nginx/sites-available/webmag kopieren, symlink setzen, nginx reload.
# root-Pfad unten an deine Umgebung anpassen.
server {
listen 80;
server_name _; # <- deinen Domainnamen eintragen
root /var/www/html/webmag; # <- Installationspfad (install.sh) anpassen
index index.html;
# Statische Magazin-Seiten: saubere URLs für die Hauptseiten
location / {
try_files $uri $uri/ =404;
}
# Gzip-Kompression (HTML/CSS/JS)
gzip on;
gzip_comp_level 5;
gzip_types text/plain text/css application/javascript application/json image/svg+xml;
# Caching: HTML kurz, Fonts/SVG länger
location ~* \.html$ {
add_header Cache-Control "no-cache, must-revalidate";
}
location ~* \.(woff2?|svg|png|jpg|webp|ico)$ {
expires 7d;
add_header Cache-Control "public";
}
# Sicherheits-Header
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options SAMEORIGIN;
add_header Referrer-Policy strict-origin-when-cross-origin;
}