67 lines
1.9 KiB
Plaintext
67 lines
1.9 KiB
Plaintext
# nginx für aircard-ios.org (Container webklar-aircard, nginx:alpine; wird nach
|
|
# /etc/nginx/conf.d/default.conf gemountet). Ausgeliefert wird die statische Seite aus
|
|
# /usr/share/nginx/html (= out/ des Build-Containers). TLS macht Traefik davor.
|
|
#
|
|
# Wichtig: In den location-Blöcken kein add_header verwenden - sonst entfallen die
|
|
# Sicherheits-Header vom server-Block. "expires" ist davon nicht betroffen.
|
|
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# Sicherheits-Header (alle Antworten, auch Fehler)
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
|
|
gzip on;
|
|
gzip_vary on;
|
|
gzip_min_length 1024;
|
|
gzip_comp_level 6;
|
|
gzip_types
|
|
text/plain
|
|
text/css
|
|
text/xml
|
|
text/javascript
|
|
application/javascript
|
|
application/json
|
|
application/manifest+json
|
|
application/xml
|
|
image/svg+xml;
|
|
|
|
# Gehashte Build-Dateien: ein Jahr, nie auf index.html zurückfallen.
|
|
location ^~ /assets/ {
|
|
try_files $uri =404;
|
|
expires 1y;
|
|
access_log off;
|
|
}
|
|
|
|
# Die Appwrite-API liegt nur über Traefik (Header X-Appwrite-Project) auf /v1.
|
|
# Ohne diesen Header darf nginx hier nie die App (index.html) ausliefern.
|
|
location ^~ /v1/ {
|
|
return 404;
|
|
}
|
|
|
|
location = /index.html {
|
|
expires -1;
|
|
}
|
|
|
|
# Versteckte Dateien sperren (außer /.well-known). Steht vor den Regex-Blöcken
|
|
# darunter, damit z. B. /.git/x.png nicht als Bild durchgeht.
|
|
location ~ /\.(?!well-known) {
|
|
deny all;
|
|
}
|
|
|
|
location ~* \.(?:png|jpe?g|gif|webp|avif|svg|ico|woff2?|ttf|otf)$ {
|
|
expires 7d;
|
|
}
|
|
|
|
# Single-Page-App: alle anderen Pfade (/karten, /editor ...) liefern index.html.
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
expires -1;
|
|
}
|
|
}
|