Skip to content

Commit cafa30b

Browse files
feat: add nginx reverse proxy on ports 80/443 with certbot SSL support
- Add nginx service proxying HTTP traffic to radar:3001 - Add certbot service for automated Let's Encrypt certificate renewal - Include ACME challenge path for initial cert issuance - HTTPS 443 block pre-configured and commented out, ready to enable after certbot Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 329a3ce commit cafa30b

2 files changed

Lines changed: 101 additions & 13 deletions

File tree

docker-compose.yml

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,28 @@ services:
2424
# volumes:
2525
# - ./server/src/Data:/app/Data:ro
2626

27-
# Optional: Add a reverse proxy (nginx)
28-
# nginx:
29-
# image: nginx:alpine
30-
# container_name: radar-proxy
31-
# ports:
32-
# - "80:80"
33-
# - "443:443"
34-
# volumes:
35-
# - ./nginx.conf:/etc/nginx/nginx.conf:ro
36-
# - ./ssl:/etc/nginx/ssl:ro
37-
# depends_on:
38-
# - radar
39-
# restart: unless-stopped
27+
nginx:
28+
image: nginx:alpine
29+
container_name: radar-nginx
30+
ports:
31+
- "80:80"
32+
- "443:443"
33+
volumes:
34+
- ./nginx.conf:/etc/nginx/nginx.conf:ro
35+
- certbot-www:/var/www/certbot:ro
36+
- certbot-certs:/etc/letsencrypt:ro
37+
depends_on:
38+
- radar
39+
restart: unless-stopped
40+
41+
certbot:
42+
image: certbot/certbot
43+
container_name: radar-certbot
44+
volumes:
45+
- certbot-www:/var/www/certbot
46+
- certbot-certs:/etc/letsencrypt
47+
entrypoint: /bin/sh -c "trap exit TERM; while :; do certbot renew --webroot -w /var/www/certbot --quiet; sleep 12h & wait $${!}; done"
48+
49+
volumes:
50+
certbot-www:
51+
certbot-certs:

nginx.conf

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
worker_processes auto;
2+
3+
events {
4+
worker_connections 1024;
5+
}
6+
7+
http {
8+
include /etc/nginx/mime.types;
9+
default_type application/octet-stream;
10+
11+
sendfile on;
12+
keepalive_timeout 65;
13+
client_max_body_size 10M;
14+
15+
# Gzip compression
16+
gzip on;
17+
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
18+
19+
# HTTP — redirect to HTTPS if SSL is configured, otherwise proxy directly
20+
server {
21+
listen 80;
22+
server_name _;
23+
24+
# Let's Encrypt ACME challenge (needed for SSL certificate issuance)
25+
location /.well-known/acme-challenge/ {
26+
root /var/www/certbot;
27+
}
28+
29+
# Redirect all HTTP traffic to HTTPS once certs are in place
30+
# Uncomment the line below and remove the location / block after running certbot
31+
# return 301 https://$host$request_uri;
32+
33+
location / {
34+
proxy_pass http://radar:3001;
35+
proxy_http_version 1.1;
36+
proxy_set_header Upgrade $http_upgrade;
37+
proxy_set_header Connection 'upgrade';
38+
proxy_set_header Host $host;
39+
proxy_set_header X-Real-IP $remote_addr;
40+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
41+
proxy_set_header X-Forwarded-Proto $scheme;
42+
proxy_cache_bypass $http_upgrade;
43+
proxy_read_timeout 90s;
44+
}
45+
}
46+
47+
# HTTPS — uncomment this block after running certbot
48+
# Replace radar.army with your actual domain
49+
#
50+
# server {
51+
# listen 443 ssl;
52+
# server_name radar.army www.radar.army;
53+
#
54+
# ssl_certificate /etc/letsencrypt/live/radar.army/fullchain.pem;
55+
# ssl_certificate_key /etc/letsencrypt/live/radar.army/privkey.pem;
56+
# ssl_protocols TLSv1.2 TLSv1.3;
57+
# ssl_ciphers HIGH:!aNULL:!MD5;
58+
#
59+
# location /.well-known/acme-challenge/ {
60+
# root /var/www/certbot;
61+
# }
62+
#
63+
# location / {
64+
# proxy_pass http://radar:3001;
65+
# proxy_http_version 1.1;
66+
# proxy_set_header Upgrade $http_upgrade;
67+
# proxy_set_header Connection 'upgrade';
68+
# proxy_set_header Host $host;
69+
# proxy_set_header X-Real-IP $remote_addr;
70+
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
71+
# proxy_set_header X-Forwarded-Proto $scheme;
72+
# proxy_cache_bypass $http_upgrade;
73+
# proxy_read_timeout 90s;
74+
# }
75+
# }
76+
}

0 commit comments

Comments
 (0)