【问题标题】:How to secure S3 static sites that are proxied through nginx using letsencrypt如何使用letsencrypt保护通过nginx代理的S3静态站点
【发布时间】:2018-01-22 20:12:54
【问题描述】:

我有大量需要保护的静态网站。它们使用静态站点配置托管在 S3 上,然后我使用 NGINX 将公共存储桶 URL 代理到其面向公众的域。

如何使用letsencrypt保护代理域?

【问题讨论】:

  • 您面临的问题是什么?它应该像在你的 nginx 机器上生成证书一样简单吗?
  • 我在使用 NGINX 插件时遇到问题,因为它需要一个我没有的网络根

标签: nginx amazon-s3 lets-encrypt


【解决方案1】:

根据您的评论,您正在寻找一种在没有本地网站时创建 Lets Encrypt SSL 证书的方法。

server {
    listen          80;
    ...

    location ^~ /.well-known {
      allow all;
      default_type "text/plain";
      root /tmp/letsencrypt;
    }

    location / {
      proxy_pass      http://your-proxied-server;
      ...
    }
}

然后使用它作为您的 webroot 来生成证书,如下所示:

sudo -H /opt/letsencrypt/certbot certonly -a webroot --webroot-path /tmp/letsencrypt  -d your.domain.here 

它将在该文件夹中创建一个文件,然后通过您的网站向该文件发出请求。

【讨论】:

    【解决方案2】:

    我最终用这个解决了我的问题:

    sudo certbot --authenticator standalone --installer nginx --pre-hook "nginx -s stop" --post-hook "nginx"
    

    【讨论】:

      猜你喜欢
      • 2018-08-05
      • 1970-01-01
      • 1970-01-01
      • 2017-03-08
      • 2021-03-29
      • 2018-04-02
      • 2020-09-29
      • 2018-10-22
      • 2010-11-10
      相关资源
      最近更新 更多