我很难在Docker中使用certbot设置SSL证书的自动续订。
以下是我的nginx配置:
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name example.com;
auth_basic_user_file .htpasswd;
# SSL
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
ssl_session_cache shared:le_nginx_SSL:10m;
ssl_session_timeout 1440m;
ssl_session_tickets off;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers off;
ssl_ciphers "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384";
client_max_body_size 4G;
keepalive_timeout 5;
location ^~ /.well-known/acme-challenge/ {
auth_basic off;
allow all;
root /etc/letsencrypt;
}
}
字符串
然后是我的docker-compose文件:
services:
certbot:
image: certbot/certbot
restart: unless-stopped
volumes:
- /etc/letsencrypt:/etc/letsencrypt
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
volumes:
database:
app:
型
当我运行容器时,我在Certbot容器中得到这个错误:
Certbot failed to authenticate some domains (authenticator: standalone). The Certificate Authority reported these problems:
Domain: example.com
Type: unauthorized
Detail: xyz: Invalid response from https://example.com/.well-known/acme-challenge/xyz: 404
型
我的配置有什么问题?
1条答案
按热度按时间mrphzbgm1#
您需要自定义certbot命令来为您的特定域名生成证书。类似的东西(我自己没有测试过):
字符串
摘自本教程:https://www.programonaut.com/setup-ssl-with-docker-nginx-and-lets-encrypt/但你可以找到很多其他的例子