LoginSignup
1
1

More than 5 years have passed since last update.

Let's Encrypt で証明書の更新

Posted at

概要

Public Beta である Let's Encrypt の証明証は3ヶ月で有効期限が切れる.言い換えれば,3ヶ月ごとに更新手続きが必要なので,備忘録としてまとめる.

証明書の更新

letsencrypt-auto コマンドに renew サブコマンドが用意されているが,証明書の取得に用いる certonly サブコマンドで更新も行える.今回は certaonly コマンドを使用した.

ドメインが sample.com でドキュメントルートが /var/www の時,証明書の更新(というか再発行)は,

$ letsencrypt-auto certonly --webroot -w /var/www -d sample.com

で行える./var/www にアクセス権がある状態で実行すること.

letsencrypt-auto コマンドがない場合

$ git clone https://github.com/letsencrypt/letsencrypt
$ cd letsencrypt
$ ./letsencrypt-auto certonly --webroot -w /var/www -d sample.com

注意

letsencrypt-auto certainly-w オプションで指定した場所に .well-known というフォルダを作る.このフォルダが Web から見えていないと認証されない.なので,リバースプロキシを設定している場合でも,このフォルダだけは転送しないようにしておく.

server {
    listen 80;
    server_name sample.com;
    rewrite (.*) https://sample.com$1 redirect;
}
server {
    listen 443 ssl;
    server_name sample.com;
    ......
    location / {
        proxy_pass http://127.0.0.1:8080;
    }
    location /.well-known/ {
        root /var/www;
    }
}
1
1
0

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
  3. You can use dark theme
What you can do with signing up
1
1