Files
argento/docker/nginx/conf.d/argento.timothykim.net.conf
2026-04-07 15:46:18 -04:00

47 lines
1.7 KiB
Plaintext

# Cockpit runs directly on the host (not Docker), proxied via host.docker.internal.
# Cockpit serves its own self-signed TLS on port 9090, so proxy_pass uses https://.
# nginx defaults proxy_ssl_verify to off, so the self-signed cert is accepted.
server {
listen 80;
listen [::]:80;
server_name argento.timothykim.net;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl;
listen [::]:443 ssl;
http2 on;
server_name argento.timothykim.net;
ssl_certificate /etc/letsencrypt/live/argento.timothykim.net/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/argento.timothykim.net/privkey.pem;
# Security headers are inlined (not included) because Cockpit uses iframes
# internally and X-Frame-Options: DENY from security-headers.inc breaks it
add_header Strict-Transport-Security "max-age=63072000; preload" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "geolocation=(), microphone=(), camera=()" always;
location / {
proxy_pass https://host.docker.internal:9090;
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;
# Cockpit uses WebSockets for terminal, system monitoring, and all UI interaction
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}