NginxコンテナへのCertbotの導入について
Nginx公式イメージにCertbotを追加した新規イメージを作成し、コンテナ起動後にCertbotによる認証手続きを行うのではなく、事前にCertbotによるSSL認証手続きを専用のDockerイメージを利用してスタンドアローンモードで行い、取得した認証ファイルをdocker-composeファイル内で指定してNginxコンテナを起動することを推奨します。
Running on Docker
https://eff-certbot.readthedocs.io/en/stable/install.html#running-with-docker
$ sudo docker run -it --rm --name certbot -v "$PWD/letsencrypt:/etc/letsencrypt" -p 80:80 certbot/certbot certonly --standalone -d www.example.com
事前にSSL認証ファイルが取得できるため、Nginxの443ポートを指定した設定ファイルを事前に用意出来ます。
更新については上の投稿記事 ”Certbotコマンドオプション” を参照してホストマシンのクローンジョブに更新コマンドを記述すること。
Certbot - ArchWiki
The factual accuracy of this article or section is disputed.
Reason: In the webroot way, the/var/lib/letsencrypt
path is dictated by certbot.
Manual creation is not necessary, that applies to #Manual.
トラブルシュート
I was writing:
./certbot-auto certonly --expand -d first.domain.com, second.domain.com
It should be:
./certbot-auto certonly --expand -d first.domain.com,second.domain.com