amazon

AWS Lightsail でお金をかけずに https 対応

はじめに

以前の記事「サルでもできる AWS Lightsail に独自ドメインの設定」で独自ドメイン運用できるようにしたので、 https で接続できるようにしましょう。

公式の方法

いくつか方法があります

  • Route53 + ACM + ELB[1]
  • lightsail のロードバランサー[2]
  • Let’s Encrypt

上記で上げた方法のうち、↑2つは意外とお金がかかります。10$/月ぐらいでしょうか。地味に高いです。

正直ブログ(5$/月)よりもお金かかるのはちょっとなのでお金をかけない方向で構築していきたいと思います。

お金をかけない設定

公式ナレッジ[3]があったのでこれを参考にしましょう。

Let’s Encrypt を用いて証明書を取得し、ブログにアクセスした際に http -> https に自動で変更してアクセスするようにします

lightsail のコンソールに移動

以前の記事「サルでもできる AWS 上に WordPress の構築」を参照ください。

Let’s Encrypt の設定

itnami@ip-172-26-12-157:~$ sudo /opt/bitnami/bncert-tool
・・・省略・・・
Domain list []: #{あなたのドメインを入力}

The following domains were not included: www.unscrupulous-business-firm.com. Do you want to add them? [Y/n]: #{www.~ のドメインを設定しているなら Y。していないなら n}

Press [Enter] to continue: #{エンター入力}

# 以下は www を指定していないのに 上記で Y を選んだためそんな奴見つからんと警告されてしまいました。妥当なドメインを再度指定し、 www~は使わないようにします
Domain list [unscrupulous-business-firm.com www.unscrupulous-business-firm.com]: unscrupulous-business-firm.com
The following domains were not included: www.unscrupulous-business-firm.com. Do you want to add them? [Y/n]: n

disabled: non-www to www, www to non-www.
Press [Enter] to continue: #{エンター入力}

Enable HTTP to HTTPS redirection [Y/n]: #{何も考えずに Y }

Do you agree to these changes? [Y/n]: #{何も考えずに Y }


E-mail address []: #{ あなたのメアドを入力しましょう }      

# Success と出れば成功です
Success
The Bitnami HTTPS Configuration Tool succeeded in modifying your installation.
The configuration report is shown below.
Backup files:
* /opt/bitnami/apache/conf/httpd.conf.back.202205021000
* /opt/bitnami/apache/conf/bitnami/bitnami.conf.back.202205021000
* /opt/bitnami/apache/conf/bitnami/bitnami-ssl.conf.back.202205021000
* /opt/bitnami/apache/conf/vhosts/wordpress-https-vhost.conf.back.202205021000
* /opt/bitnami/apache/conf/vhosts/wordpress-vhost.conf.back.202205021000
Find more details in the log file:
/tmp/bncert-202205021000.log
If you find any issues, please check Bitnami Support forums at:
https://community.bitnami.com
Press [Enter] to continue: # エンター押します

http://#{あなたのドメイン} でアクセスした際に https://~ とブラウザに表示されていたら成功です。

参考

[1] ACM、Route53、ALBの連携, https://dev.classmethod.jp/articles/alb-route53-acm-build2/

[2] AWSでWebサイトをHTTPS化 その8:Lightsail(+証明書)編, https://recipe.kc-cloud.jp/archives/11443

[3] Amazon Lightsail でホストされている Bitnami スタックにスタンダード Let’s Encrypt SSL 証明書をインストールするにはどうすればよいですか?, https://aws.amazon.com/jp/premiumsupport/knowledge-center/linux-lightsail-ssl-bitnami/

コメント

タイトルとURLをコピーしました