WordPress(AWS+Bitnami) – SSL対応(Let’s Encrypt)

近年、各種ブラウザが「安全ではない」とか「保護されていない」とかおっしゃるのでHTTPS化しました。手順を残しておきます。

前提として、WordpressはAWSのEC2でBitnamiイメージを使用して構築しています。
ドメインはRoute53で紐づけています。

関連記事 – 「WordPressの構築・運用方法」

課題

  • HTTPS対応したい。

最近のブラウザは横暴です。人のサイトを最早汚物扱い。

ブラウザ様の横暴

Google Crome

wordpress-ssl-crome-warn

Microsoft Edge

wordpress-ssl-edge-warn

Firefox

wordpress-ssl-firefox-warn

httpのサイトにhttpsをつけてアクセス

wordpress-ssl-crome-warn2

解決策

  • Let’s EncryptでSSL(HTTPS)対応する

手順

  • Tera Termなどでご自身のインスタンスに接続する → わからない場合はこちら
  • bncert-toolの設定

bncert-toolの設定

bncert-toolが必要になるので通常はインストールからですが、
Bitnamiイメージを使って立ち上げたWordpress環境には最初からインストールされているみたいです。

ですので、早速起動から行きます。

  • sudo /opt/bitnami/bncert-toolとコマンドを打ちます。
bitnami@ip-XXX-XXX-XXX-XXX:~$ sudo /opt/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 [premium-tsubu-hero.net www.premium-tsubu-hero.net]: www.premium-tsubu-hero.net
  • ドメインは含まれていない。追加するか?と聞いてくるので [Y]を入力
The following domains were not included: premium-tsubu-hero.net. Do you want to add them? [Y/n]: Y

Warning: The domain 'premium-tsubu-hero.net' does not resolve, please fix its
DNS entries or remove it.
  • Enterを押せと言ってくるので[Enter]
Press [Enter] to continue:
----------------------------------------------------------------------------
Domains

Please provide a valid space-separated list of domains for which you wish to
configure your web server.
  • ドメイン設定した際、IPアドレスと紐づけた名前を入力します。僕の場合はwww.ドメイン名。Route53の管理画面でも確認できます。
Domain list [www.premium-tsubu-hero.net premium-tsubu-hero.net]: www.premium-tsubu-hero.net
  • ドメイン名を追加するか?(ドメインの前の名前(僕の場合はwww)無し)と聞いてくるので僕は[n]。
The following domains were not included: premium-tsubu-hero.net. Do you want to add them? [Y/n]: Y
  • Enterを押せと言っているので[Enter]。
Press [Enter] to continue:
----------------------------------------------------------------------------
Enable/disable redirections

Please select the redirections you wish to enable or disable on your Bitnami
installation.
  • http→httpsのリダイレクトを有効にするかと聞いているので[Y]
Enable HTTP to HTTPS redirection [Y/n]: Y

----------------------------------------------------------------------------
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.premium-tsubu-hero.net
3. Configure a cron job to automatically renew the certificate each month
4. Configure web server name to: www.premium-tsubu-hero.net
5. Enable HTTP to HTTPS redirection (example: redirect
http://premium-tsubu-hero.net to https://premium-tsubu-hero.net)
6. Start web server once all changes have been performed
  • 色々言ってきました。気になる人はしっかりと読んでこれらの変更を許可します。[Y]
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.premium-tsubu-hero.net

Server name: www.premium-tsubu-hero.net
  • E-mailアドレス入れろとのこと
E-mail address []: XXXXXXXXXX@XXXXXXX.XXX

The Let's Encrypt Subscriber Agreement can be found at:

https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf
  • PDF読んで理解したか?とのこと。[Y]
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:
* /opt/bitnami/apache2/conf/httpd.conf.back.202007110605
* /opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf.back.202007110605
* /opt/bitnami/apache2/conf/bitnami/bitnami.conf.back.202007110605

Find more details in the log file:

/tmp/bncert-202007110605.log

If you find any issues, please check Bitnami Support forums at:

https://community.bitnami.com
  • Enterを押せとのこと [Enter]
Press [Enter] to continue:
  • apache再起動[sudo /opt/bitnami/ctlscript.sh restart apache]
sudo /opt/bitnami/ctlscript.sh restart apache

まとめ

今回はSSL(HTTPS)への対応について記述しました。
誤り等あればご指摘いただければ幸甚です。

おわり

PR

コメント

コメントを残す

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