user nginx; worker_processes auto; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; client_max_body_size 100M; gzip on; gzip_vary on; gzip_min_length 1024; gzip_types text/plain text/css text/xml text/javascript application/javascript application/json application/xml+rss image/svg+xml; upstream outline { server 127.0.0.1:3100; } server { listen 3200 default_server; listen [::]:3200 default_server; server_name wiki.ghostguild.org; # Serve custom theme files location /custom/ { alias /opt/ghost-guild-wiki-theme/; expires 1h; add_header Cache-Control "public"; } # Health check location = /api/health { proxy_pass http://outline; access_log off; } # Homepage: inject OG meta tags + CSS location = / { proxy_pass http://outline; 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; proxy_set_header Accept-Encoding ""; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; # OG tags after
so they appear before Outline's own tags sub_filter '' ''; # CSS injection (must redeclare; sub_filter doesn't inherit across location blocks) sub_filter '' ''; sub_filter_once on; sub_filter_types text/html; } # Reverse proxy to Outline with CSS injection location / { proxy_pass http://outline; # Standard proxy headers 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 encoding so sub_filter can process the response proxy_set_header Accept-Encoding ""; # WebSocket support (required for real-time collaboration) proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; # Inject custom CSS before sub_filter '' ''; sub_filter_once on; sub_filter_types text/html; } } }