CentOS9のapacheで Let's Encrypt 使いたい
問題
CentOS 9 Stream で Let's Encrypt 使おうとしたら certbotコマンドでエラーになりました。
# certbot certonly --apache
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Error in checking parameter list:
The apache plugin is not working; there may be problems with your existing configuration.
The error was: MisconfigurationError('Apache is unable to check whether or not the module is loaded because Apache is misconfigured.')
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
答え
--apache するとダメだが、自分でオプションを指定すれば実行できて、サーバー証明書を取得できる。
certbot certonly --webroot -w /ドキュメントルート -d ドメイン名
取得後は、certbot renew もできた。
メモ
certbotのオプション
Options:
-n: Not interactive
--webroot: Place files in the document root of an already running server
-w: The document root (where to place the files)
-d: The domain
-d: Another domain
メモ2
Apache設定例
<VirtualHost *:443>
(略)
SSLCertificateFile /etc/letsencrypt/live/ドメイン名/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/ドメイン名/privkey.pem
SSLEngine On
</VirtualHost>
メモ3
よく見るとプラグイン(パッケージ)が足りないだけだったようだ。
以下を追加したらすんなりサーバー証明書を取得できた。
# yum install python3-certbot-apache