Let’s Encrypt で証明書を取得する

こんにちは。
急に寒くなってきましたね。
ところで Let’s Encrypt でサイトを SSL化しました。
その際の備忘録になります。

certbotのインストール

epel から certbot のパッケージを落とします。

yum install epel-release
yum install certbot

証明書の取得

certbot certonly --webroot \
-w 【ドキュメントルート】 \
-d 【ドメイン名】 \
-m 【メールアドレス】 \
--agree-tos -n

※ 下記ディレクトリに証明書が生成されます。

# サーバ証明書
/etc/letsencrypt/live/【ドメイン名】/cert.pem
# 秘密鍵
/etc/letsencrypt/live/【ドメイン名】/privkey.pem
# 中間証明書
/etc/letsencrypt/live/【ドメイン名】/chain.pem

あとは、WEBサーバに設定すればOK

<VirtualHost *:443>
   ServerAdmin n41210guitar@gmail.com
   ServerName fingerease.work
   DocumentRoot "/var/www/vhosts/fingerease.work/public_html"
   DirectoryIndex wordpress index.php index.html index.xml
   <Directory /var/www/vhosts/fingerease.work/public_html>
           Options FollowSymLinks
           AllowOverride all
   </Directory>
   
   SSLEngine on
   SSLProtocol             all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
   SSLCipherSuite          ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
   SSLHonorCipherOrder     off

   SSLCertificateFile /etc/letsencrypt/live/fingerease.work/cert.pem
   SSLCertificateKeyFile /etc/letsencrypt/live/fingerease.work/privkey.pem
   SSLCertificateChainFile /etc/letsencrypt/live/fingerease.work/chain.pem

   CustomLog "/var/log/httpd/fingerease.work-ssl-access_log" combined
   ErrorLog  "/var/log/httpd/fingerease.work-ssl-error_log"
</VirtualHost>

投稿者: snk

保有資格 ・TOEIC 835 ・LPIC 304 ・AWS SAA/SAP ・GCP PCA ・IPA SC

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です