WordPress BitnamiのSSL証明書を手動で更新した話(作業ログ)
「ある日、WordPressが死んでいた話(ただの作業ログ)」でWordperssを復旧した後、
SSL証明書の更新がちょうどサーバが落ちている時に走って失敗していたことに気づいたので、手動で更新した話(作業ログ)
(Twitterのカード表示が失敗していたことから、HTTPS化がうまくいっていないことに気づいた)
(サーバ監視とかやらなきゃなぁ、、)
Really Simple SSL側での作業
SSL管理にはReally Simple SSL プラグインを使っているので、まずは、ダッシュボードを確認
案の定「Automatic certificate detection is not possible on your server」と言われているので
「Install SSL certificate」をクリックする
そのままDNSレコード登録など進めていくと、Installationの画面でなんと「Your hosting environment does not allow automatic SSL installation」と言われてしまった
しょうがないので「Instructions」をクリックして確認する
手動更新
「Instructions」をクリックした先が以下のサイト
「AWSの場合は”bncert tool”を使え」とのことなので、以前対応したことを思い出し、過去記事 を参考に更新する
bncert-toolを実行すると、アップデートしろと言われるのでアップデートする
~$ sudo /hogehoge/bitnami/bncert-tool An updated version is available. Would you like to download it? You would need to run it manually later. [Y/n]: Y The tool will exit now. To run the updated version run the following command: /hogehoge/bitnami/bncert-tool ~$
アップデートされたので再度bncert-toolを実行
対話形式で質問に答え、証明書を更新する
~$ sudo /hogehoge/bitnami/bncert-tool ---------------------------------------------------------------------------- Welcome to the Bitnami HTTPS Configuration tool. ---------------------------------------------------------------------------- Domains Please provide a valid space-separated list of domains for which you wish to configure your web server. Domain list []: www.yoshiislandblog.net The following domains were not included: yoshiislandblog.net. Do you want to add them? [Y/n]: Y ---------------------------------------------------------------------------- Enable/disable redirections Please select the redirections you wish to enable or disable on your Bitnami installation. Enable HTTP to HTTPS redirection [Y/n]: Y Enable non-www to www redirection [Y/n]: Y Enable www to non-www redirection [y/N]: N ---------------------------------------------------------------------------- Changes to perform The following changes will be performed to your Bitnami installation: 1. Stop web server 2. Configure web server to use a free Let's Encrypt certificate for the domains: www.yoshiislandblog.net yoshiislandblog.net 3. Configure a cron job to automatically renew the certificate each month 4. Configure web server name to: www.yoshiislandblog.net 5. Enable HTTP to HTTPS redirection (example: redirect https://www.yoshiislandblog.net to https://www.yoshiislandblog.net) 6. Enable non-www to www redirection (example: redirect yoshiislandblog.net to www.yoshiislandblog.net) 7. Start web server once all changes have been performed Do you agree to these changes? [Y/n]: Y ---------------------------------------------------------------------------- Create a free HTTPS certificate with Let's Encrypt Please provide a valid e-mail address for which to associate your Let's Encrypt certificate. Domain list: www.yoshiislandblog.net yoshiislandblog.net Server name: www.yoshiislandblog.net E-mail address []: hogehoge The Let's Encrypt Subscriber Agreement can be found at: https://letsencrypt.org/documents/LE-SA-v1.3-September-21-2022.pdf Do you agree to the Let's Encrypt Subscriber Agreement? [Y/n]: Y ---------------------------------------------------------------------------- Performing changes to your installation The Bitnami HTTPS Configuration Tool will perform any necessary actions to your Bitnami installation. This may take some time, please be patient. ---------------------------------------------------------------------------- Success The Bitnami HTTPS Configuration Tool succeeded in modifying your installation. The configuration report is shown below. Backup files: * /hogehoge/bitnami/apache2/conf/httpd.conf.back.202211131853 * /hogehoge/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf.back.202211131853 * /hogehoge/bitnami/apache2/conf/bitnami/bitnami.conf.back.202211131853 Find more details in the log file: /tmp/bncert-202211131853.log If you find any issues, please check Bitnami Support forums at: https://github.com/bitnami/vms Press [Enter] to continue: ~$
「Configure a cron job to automatically renew the certificate each month」とあるように、これを設定しておくと自動で毎月証明書を更新してくれる(便利!)
最後に、Really Simple SSLの画面に戻って「Save adn continue」をクリックすれば完了!
以上。