让我们在Nginx Docker容器中进行加密

时间:2018-07-01 14:25:09

标签: docker nginx https lets-encrypt

我是让我们加密的新手,我想将它与我的Docker容器配对使用。

我也在使用nginx。

我的nginx的Docker文件如下所示:

FROM nginx:1.13
RUN apt-get update && apt-get install -y git-core
RUN git clone https://github.com/letsencrypt/letsencrypt
RUN yes | ./letsencrypt/certbot-auto certonly --standalone --agree-tos --non-interactive --email pavlo@timebarter.co -d stage.timebarter.co
RUN rm /etc/nginx/conf.d/default.conf

但是它说:

The server could not connect to the client to verify the domain :: Fetching http://stage.timebarter.co/.well-known/acme-challenge/Sx7Km48vhi-SJlYdLhDbbKSiLL9Bdj_PoylnDt0Dl_A: Connection refused

我正在搜索这个问题,发现它可能与手动(certonlystandalone模式)有关。

我还试图跑步:

RUN yes | ./letsencrypt/certbot-auto --agree-tos --non-interactive --email pavlo@timebarter.co -d stage.timebarter.co

同样的问题在这里:

urn:acme:error:connection :: The server could not connect to the client to verify the domain :: Fetching http://stage.timebarter.co/.well-known/acme-challenge/0Mv3aEpm5HAEwLfPkFTEhH4u74hnzgeGyHGMPV9570I: Connection refused

那么,我在哪里做错了什么?因为我希望添加它非常容易,让我们加密证书以支持HTTP。

1 个答案:

答案 0 :(得分:0)

您是否考虑过使用dockerhub中托管的Letsencrypt容器?

从文档中:

  

此容器设置Nginx Web服务器并使用php反向代理   支持和内置的letencrypt客户端,可自动执行免费的SSL   服务器证书的生成和续订过程。它还包含   fail2ban用于入侵防御。