plyrs/plyrs.github.io

Let's Encrypt と http2 と Node と

Closed this issue · 4 comments

hiz8 commented

CloudFlare を利用してTLS化していたサイトを、Let's Encrypt へ移行した。

参考にした記事ではWebroot プラグインを使用し、サーバーを停止せずに行う手法が多数でしたが、僕の環境(Node.js)だと少しハマったのでStandalone で取得を行った。

まずはCloudFlare を停止し、Aレコードを直接サーバーへ設定。

# gitで取得
$ sudo git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt
# Nginx を停止
$ sudo systemctl stop nginx

# 80番ポートが塞がれていないかチャック
$ netstat -na | grep ':80.*LISTEN'
# Let' sencrypt フォルダへ移動
$ cd /opt/letsencrypt

# Stndalone プラグインを実行
$ ./letsencrypt-auto certonly --standalone

情報を入力し規約に同意して完了。

$ sudo ls /etc/letsencrypt/live/your_domain_nam
# Nginx を起動
$ sudo systemctl start nginx
hiz8 commented

証明書の更新は

# nginxを停止(80番ポートを開ける)
$ sudo systemctl stop nginx

# 更新
$ ./letsencrypt-auto renew

# nginxを起動
$ sudo systemctl start nginx
hiz8 commented

Centos7 で新規取得に少しハマった。
443ポートを開放したら解決した、バージョンによる相違だろうか。

$ sudo firewall-cmd --permanent --add-port=443/tcp
$ sudo firewall-cmd --reload
hiz8 commented

登録されている証明書を確認する。

$ ./letsencrypt-auto certificates

登録されている証明書を削除する。

$ ./letsencrypt-auto delete --cert-name your-cert-name