Skip to content

Commit 733c114

Browse files
feat: enable HTTPS with Cloudflare Origin Certificate
- Uncomment and activate HTTPS server block on port 443 - Switch from Let's Encrypt/certbot to Cloudflare Origin Certificate (stored at ./ssl/origin.pem + origin.key, mounted read-only into nginx) - Remove certbot service and unused volumes — not needed behind Cloudflare proxy - Redirect all HTTP traffic to HTTPS Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6a7050e commit 733c114

2 files changed

Lines changed: 13 additions & 46 deletions

File tree

docker-compose.yml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,8 @@ services:
3232
- "443:443"
3333
volumes:
3434
- ./nginx.conf:/etc/nginx/nginx.conf:ro
35-
- certbot-www:/var/www/certbot:ro
36-
- certbot-certs:/etc/letsencrypt:ro
35+
- ./ssl:/etc/nginx/ssl:ro
3736
depends_on:
3837
- radar
3938
restart: unless-stopped
4039

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: 12 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,18 @@ http {
2626
root /var/www/certbot;
2727
}
2828

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;
29+
return 301 https://$host$request_uri;
30+
}
31+
32+
# HTTPS — Cloudflare Origin Certificate
33+
server {
34+
listen 443 ssl;
35+
server_name radar.army www.radar.army;
36+
37+
ssl_certificate /etc/nginx/ssl/origin.pem;
38+
ssl_certificate_key /etc/nginx/ssl/origin.key;
39+
ssl_protocols TLSv1.2 TLSv1.3;
40+
ssl_ciphers HIGH:!aNULL:!MD5;
3241

3342
location / {
3443
proxy_pass http://radar:3001;
@@ -43,34 +52,4 @@ http {
4352
proxy_read_timeout 90s;
4453
}
4554
}
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-
# }
7655
}

0 commit comments

Comments
 (0)