Fix: nginx root auf frontend-Verzeichnis + try_files für Next.js Static Export
root war auf backend/static statt frontend/ - alle Seiten außer / wurden nach Hard Reload nicht gefunden. try_files ergänzt um $uri.html damit /datasets → datasets.html korrekt aufgelöst wird. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
upstream zfs_backend {
|
||||
server 127.0.0.1:8000;
|
||||
}
|
||||
|
||||
# Redirect HTTP zu HTTPS auf Port 8090
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name _;
|
||||
return 301 https://$host:8090$request_uri;
|
||||
}
|
||||
|
||||
# HTTPS Server auf Port 8090
|
||||
server {
|
||||
listen 8090 ssl http2;
|
||||
listen [::]:8090 ssl http2;
|
||||
server_name _;
|
||||
|
||||
# SSL-Zertifikate
|
||||
ssl_certificate /opt/zfs-manager/ssl/zfs-manager.crt;
|
||||
ssl_certificate_key /opt/zfs-manager/ssl/zfs-manager.key;
|
||||
|
||||
# SSL-Sicherheit
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
# Gzip compression
|
||||
gzip on;
|
||||
gzip_types text/plain text/css application/json application/javascript;
|
||||
|
||||
root /opt/zfs-manager/frontend;
|
||||
|
||||
# API endpoints - proxy to FastAPI
|
||||
location /api/ {
|
||||
proxy_pass http://zfs_backend;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
# API Docs
|
||||
location /docs {
|
||||
proxy_pass http://zfs_backend;
|
||||
proxy_set_header Host $host;
|
||||
}
|
||||
|
||||
location /openapi.json {
|
||||
proxy_pass http://zfs_backend;
|
||||
proxy_set_header Host $host;
|
||||
}
|
||||
|
||||
# Static assets - serve directly with long cache
|
||||
location /_next/static/ {
|
||||
expires 365d;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
|
||||
location /public/ {
|
||||
expires 7d;
|
||||
}
|
||||
|
||||
# Frontend SPA - fallback to index.html
|
||||
location / {
|
||||
try_files $uri $uri.html $uri/ /index.html;
|
||||
expires 0;
|
||||
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user