LoginSignup
4

More than 3 years have passed since last update.

posted at

updated at

Let's encrypt で 一時ファイルが作成できない時の対策

Let's Encrypt ユーザーガイド
上記に次の記述があります。

Webroot プラグインは ${webroot-path}/.well-known/acme-challenge に一時ファイル(ワンタイムトークン)
を作成し、Let's Encrypt の認証サーバから HTTP リクエスト(名前解決には DNS のAレコードを使用)
で取得することにより、認証を行います。
もし、ウェブサーバの設定によって /.well-known に対して特別な扱いがされている場合には、
/.well-known/acme-challenge 内のファイルに外部からアクセス可能にするために
設定を変更する必要があるかもしれません。

/.well-known/acme-challenge にアクセスできるようにするには、

nginx.conf に

location ^~ /.well-known/acme-challenge/ {
     default_type "text/plain";
}

を加えます。

nginx.conf が正しいか確認

sudo nginx -t

Nginx の再起動

sudo systemctl restart nginx

上記は、CentOS 7 で確認しました。

次の記述は誤りです。

2018年3月以降のLet's Encrypt の証明書は、一時ファイルとして
/.well-known/acme-challenge
を使いません。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
4