まえがき
開発者にとってはhttps対応は必須と思われるくらい重要な対応ですが、インストールしたばかりの状態ではhttpでしかアクセスできません。bitnamiに簡単にhttps対応できるツールがありますので活用してさくっと対応しましょう。
bncert-toolがインストールされているか確認する
まずはwordpressインスタンスにSSH接続します。

以下のコマンドを実行して bncert-tool
を実行します。
sudo /opt/bitnami/bncert-tool
command not found
が表示される方は bncert-tool
がインストールされていないのでインストールしてください。
表示されなければインストールされているのでhttpsを有効にする作業へ進んでください。以下が表示される場合はbncert-tool
が最新ではないのでy
を入力して更新してください。
An updated version is available. Would you like to download it? You would need to run it m
anually later. [Y/n]: y
httpsを有効にする
bncert-tool
を実行すると以下が表示されます。
順番に設定の入力を求められるので自分の環境に合った内容を入力します。
----------------------------------------------------------------------------
Welcome to the Bitnami HTTPS Configuration tool.
----------------------------------------------------------------------------
Domain list []
ドメインの入力を求められるのでWordPressで利用するドメインを入力します。半角スペース区切りで複数入力できます。
Domain list []: domain.com xxx.domain.com
The following domains were not included
サブドメインにwwwを含むドメインが入力されていないと表示されます。
- サブドメインにwwwを使わない場合は
n
を入力 - サブドメインにwwwを使う場合は
y
を入力
Enable HTTP to HTTPS redirection
httpのURLでアクセスした場合にhttpsのURLにリダイレクトさせるかどうか設定します。
- 特に理由がない限り有効にするため
y
を入力 - 特別な理由があり、httpとhttpsを分けたい場合は`n`を入力
Do you agree to these changes?
変更内容の確認と変更に伴って発生する動作を確認されるので、内容を確認してy
を入力します。
Changes to perform
The following changes will be performed to your Bitnami installation:
# 設定反映中、Webサーバーを停止します
1. Stop web server
# 入力したドメインの確認
2. Configure web server to use a free Let's Encrypt certificate for the domains:
xxx.domain.com
# SSL証明書が毎月更新されるようにスケジュールを作成します
3. Configure a cron job to automatically renew the certificate each month
# Webサーバー名の確認
4. Configure web server name to: xxx.domain.com
# httpからhttpsへのリダイレクト設定の確認
5. Enable HTTP to HTTPS redirection (example: redirect http://xxx.domain.com to
https://xxx.domain.com)
# 全ての設定が完了したらWebサーバーを起動します
6. Start web server once all changes have been performed
続いて入力を求められるので、SSL証明書の初期設定をしていきます。
Do you agree to the Let’s Encrypt Subscriber Agreement?
以下の文章が表示され、 SSL証明書の設定を求められます。
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.
SSL証明書に紐づけるメールアドレスを入力し、`y`を入力して証明書の作成を開始します。
E-mail address []: testmail@example.com
Press [Enter] to continue
証明書の作成が正常に終了すると、以下のメッセージが表示されます。
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.202107302353
* /opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf.back.202107302353
* /opt/bitnami/apache2/conf/bitnami/bitnami.conf.back.202107302353
Find more details in the log file:
/tmp/bncert-202107302353.log
動作確認
- 設定したドメインに対してhttpsから始まるURLでアクセスして問題なくアクセスできるか
- httpから始まるURLでアクセスした際にhttpsから始まるURLにリダイレクトされるか
- httpからhttpsへのリダイレクトを有効にしない場合は不要
- ブラウザの欄にある鍵マークをクリックした際に、証明書が有効になっているか

あとがき
いろいろと画面やディレクトリを移動してやっと実現できたhttps対応もツールを使って簡単に設定できました。便利なツールを使っていくと効率化出来て最高ですが、そのツールが何をやっているのかちゃんと理解して使っていきたいものです。
この記事で問題が解消できなかった方向けに私が参考にしたサイトも紹介しておきます。
コメント