Add nginx configuration for Hub deployment

Includes:
- HTTP to HTTPS redirect
- Placeholder SSL certs for initial nginx -t pass
- Proxy to Hub API on port 8200
- ACME challenge location for certbot
- WebSocket support headers
- Usage instructions in comments

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Matt 2025-12-22 14:23:24 +01:00
parent 246e7f142a
commit 06ed320136
1 changed files with 59 additions and 0 deletions

59
hub.nginx.conf Normal file
View File

@ -0,0 +1,59 @@
# Nginx configuration for LetsBe Hub
# Usage:
# 1. Copy to /etc/nginx/sites-available/hub.letsbe.biz
# 2. Create symlink: ln -s /etc/nginx/sites-available/hub.letsbe.biz /etc/nginx/sites-enabled/
# 3. Create placeholder certs (for initial nginx -t):
# openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
# -keyout /etc/nginx/placeholder.key -out /etc/nginx/placeholder.crt \
# -subj "/CN=placeholder"
# 4. Test: nginx -t
# 5. Reload: systemctl reload nginx
# 6. Get real certs: certbot --nginx -d hub.letsbe.biz
server {
listen 80;
server_name hub.letsbe.biz;
location / {
return 301 https://$host$request_uri;
}
location ^~ /.well-known/acme-challenge/ {
alias /var/www/html/.well-known/acme-challenge/;
default_type "text/plain";
allow all;
}
}
server {
listen 443 ssl http2;
server_name hub.letsbe.biz;
# Placeholder certs - certbot will replace these
ssl_certificate /etc/nginx/placeholder.crt;
ssl_certificate_key /etc/nginx/placeholder.key;
# SSL settings (certbot will add its own)
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers off;
location / {
proxy_pass http://127.0.0.1:8200;
proxy_redirect off;
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;
# WebSocket support (if needed later)
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location ^~ /.well-known/acme-challenge/ {
alias /var/www/html/.well-known/acme-challenge/;
default_type "text/plain";
allow all;
}
}