initial commit
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
services:
|
||||
nginx:
|
||||
image: nginx:alpine
|
||||
restart: unless-stopped
|
||||
container_name: nginx
|
||||
networks:
|
||||
- shared
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
ports:
|
||||
- '80:80'
|
||||
- '443:443'
|
||||
- '24444:24444' # for mcsmanager-daemon
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
- ./conf.d:/etc/nginx/conf.d:ro
|
||||
- /etc/letsencrypt:/etc/letsencrypt:ro
|
||||
- ./certbot/www:/var/www/certbot:ro
|
||||
|
||||
networks:
|
||||
shared:
|
||||
name: shared
|
||||
@@ -0,0 +1,20 @@
|
||||
# Drop connections with unknown/missing Host headers
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
server_name _;
|
||||
return 444;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl default_server;
|
||||
listen [::]:443 ssl default_server;
|
||||
http2 on;
|
||||
server_name _;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/argento.timothykim.net/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/argento.timothykim.net/privkey.pem;
|
||||
|
||||
return 444;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
# Template for new app confs.
|
||||
# 1. Copy this file: cp _template.conf.example <domain>.conf
|
||||
# 2. Replace DOMAIN with the actual domain
|
||||
# 3. Replace UPSTREAM_NAME and CONTAINER:PORT with the app's container and port
|
||||
# 4. Run issue-cert.sh <domain> if cert doesn't exist yet
|
||||
# 5. Copy to argento, nginx -t && nginx -s reload
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name DOMAIN;
|
||||
|
||||
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 DOMAIN;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/DOMAIN/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/DOMAIN/privkey.pem;
|
||||
|
||||
include /etc/nginx/conf.d/security-headers.inc;
|
||||
|
||||
# Use a variable so nginx starts even if the upstream is down
|
||||
set $upstream_UPSTREAM_NAME http://CONTAINER:PORT;
|
||||
|
||||
location / {
|
||||
proxy_pass $upstream_UPSTREAM_NAME;
|
||||
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;
|
||||
|
||||
# Uncomment if the app uses WebSockets
|
||||
# proxy_http_version 1.1;
|
||||
# proxy_set_header Upgrade $http_upgrade;
|
||||
# proxy_set_header Connection "upgrade";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
# 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";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name garage.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 garage.timothykim.net;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/garage.timothykim.net/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/garage.timothykim.net/privkey.pem;
|
||||
|
||||
include /etc/nginx/conf.d/security-headers.inc;
|
||||
|
||||
set $upstream_garage http://garage-webui:3909;
|
||||
|
||||
location / {
|
||||
proxy_pass $upstream_garage;
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name git.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 git.timothykim.net;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/git.timothykim.net/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/git.timothykim.net/privkey.pem;
|
||||
|
||||
include /etc/nginx/conf.d/security-headers.inc;
|
||||
|
||||
# Git push/LFS operations can be large
|
||||
client_max_body_size 100M;
|
||||
|
||||
set $upstream_gitea http://gitea:3000;
|
||||
|
||||
location / {
|
||||
proxy_pass $upstream_gitea;
|
||||
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;
|
||||
# Gitea API token auth (used by CI runners and git CLI) arrives as
|
||||
# Authorization: Basic/Bearer — pass it through explicitly
|
||||
proxy_set_header Authorization $http_authorization;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
# Jellyfin runs on the host network (not Docker shared network) because it
|
||||
# needs direct access to hardware transcoding devices. Proxied via
|
||||
# host.docker.internal instead of container name.
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name jellyfin.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 jellyfin.timothykim.net;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/jellyfin.timothykim.net/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/jellyfin.timothykim.net/privkey.pem;
|
||||
|
||||
include /etc/nginx/conf.d/security-headers.inc;
|
||||
|
||||
# Poster and metadata image uploads
|
||||
client_max_body_size 20M;
|
||||
|
||||
location / {
|
||||
proxy_pass http://host.docker.internal:8096;
|
||||
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;
|
||||
|
||||
# Disable buffering when the nginx proxy gets very resource heavy upon streaming
|
||||
proxy_buffering off;
|
||||
|
||||
# Jellyfin uses WebSockets for real-time playback state and remote control
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
|
||||
# Dedicated WebSocket endpoint for SyncPlay and client communication
|
||||
location /socket {
|
||||
proxy_pass http://host.docker.internal:8096;
|
||||
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;
|
||||
|
||||
# sync play compatibility?
|
||||
proxy_set_header X-Forwarded-Protocol $scheme;
|
||||
proxy_set_header X-Forwarded-Host $http_host;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
# HTTP-only: HTTPS causes WebSocket/CORS errors with the MCSManager daemon connection.
|
||||
# No ACME challenge block needed since there's no cert to renew.
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name minecraft.thekims.family;
|
||||
|
||||
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 minecraft.thekims.family;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/minecraft.thekims.family/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/minecraft.thekims.family/privkey.pem;
|
||||
|
||||
include /etc/nginx/conf.d/security-headers.inc;
|
||||
|
||||
set $mcsmanager_web http://mcsmanager-web:23333;
|
||||
|
||||
location / {
|
||||
proxy_pass $mcsmanager_web;
|
||||
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;
|
||||
|
||||
|
||||
# MCSManager uses WebSockets for real-time console/terminal
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
server {
|
||||
listen 24444 ssl;
|
||||
listen [::]:24444 ssl;
|
||||
server_name minecraft.thekims.family;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/minecraft.thekims.family/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/minecraft.thekims.family/privkey.pem;
|
||||
|
||||
include /etc/nginx/conf.d/security-headers.inc;
|
||||
|
||||
set $mcsmanager_daemon http://mcsmanager-daemon:24444;
|
||||
|
||||
location / {
|
||||
proxy_pass $mcsmanager_daemon;
|
||||
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;
|
||||
|
||||
# MCSManager uses WebSockets for real-time console/terminal
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name nextcloud.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 nextcloud.timothykim.net;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/nextcloud.timothykim.net/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/nextcloud.timothykim.net/privkey.pem;
|
||||
|
||||
include /etc/nginx/conf.d/security-headers.inc;
|
||||
|
||||
# Nextcloud file uploads can be up to 20G
|
||||
client_max_body_size 20G;
|
||||
# Stream uploads directly to Nextcloud instead of buffering to disk first
|
||||
proxy_request_buffering off;
|
||||
|
||||
set $upstream_nextcloud http://nextcloud:80;
|
||||
|
||||
location / {
|
||||
proxy_pass $upstream_nextcloud;
|
||||
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;
|
||||
}
|
||||
|
||||
# Nextcloud requires these redirects for CalDAV/CardDAV client discovery
|
||||
location /.well-known/carddav {
|
||||
return 301 /remote.php/dav;
|
||||
}
|
||||
|
||||
location /.well-known/caldav {
|
||||
return 301 /remote.php/dav;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
add_header Strict-Transport-Security "max-age=63072000; preload" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header X-Frame-Options "DENY" always;
|
||||
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
||||
add_header Permissions-Policy "geolocation=(), microphone=(), camera=()" always;
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
worker_processes auto;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
sendfile on;
|
||||
keepalive_timeout 65;
|
||||
|
||||
access_log /var/log/nginx/access.log;
|
||||
error_log /var/log/nginx/error.log;
|
||||
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384;
|
||||
ssl_prefer_server_ciphers off;
|
||||
ssl_session_cache shared:SSL:10m;
|
||||
ssl_session_timeout 1d;
|
||||
ssl_session_tickets off;
|
||||
resolver 127.0.0.11 valid=30s;
|
||||
resolver_timeout 5s;
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user