LoginSignup
1
0

WordPress(On Lightsail)のSSL化設定ツールを試してみた

Posted at

1. はじめに

Amazon LightsailでWordPressを構築する際に、サイトのSSL化対応は必須となってきますが、そのやり方は多岐に渡ります。
CDNやLBを前方に配置して証明書を設置するやWPのプラグインで対応する等やり方は本当に沢山ありますが、個人的には、Bitnamiの自動化ツールを実行するのが一番手っ取り早いと思っています。
本記事では、その自動化ツールの実行手順を記載します。

2. ハンズオン

2.1 概要

  • BitnamiのSSL化自動化ツールを実行します
  • SSL化するドメインがあれば、他に事前準備は不要です

2.2 実行環境

  • Amazon Lightsail
  • WordPress 6.4.3-8
  • Debian Ver 11.9

2.2 ツール実行手順

  1. 対象インスタンスへSSH接続する

  2. 下記コマンドを実行する

    sudo /opt/bitnami/bncert-tool
    
    • 初回実行時に下記の出力があれば「Y」と入力し、ツールをアップデートする

      bitnami@<ホスト名>:/home/bitnami# sudo /opt/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: 
      
      /opt/bitnami/bncert-tool 
      
  3. ツールが実行されるので、SSL化対象のドメインを入力する。その後wwwが含まれていないけど大丈夫ですか?と聞かれるので問題無ければ「Y」と返す
    ※wwwも含めてSSL化したのであれば「n」と返してください

    root@prod-chibi-portfolio-lab-1-Step2:/home/bitnami# 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 []: chibinfra-techlab.com
    
    The following domains were not included: www.chibinfra-techlab.com. Do you want to add them? [Y/n]: Y
    
  4. 下記の質問が聞かれるので、それぞれ「Y」か「n」で返します。

    • HTTPからHTTPSへのリダイレクトを有効にしますか?
    • www無しからwww有りへのリダイレクトを有効にしますか?
    • www有りからwww無しへのリダイレクトを有効にしますか?
    ----------------------------------------------------------------------------
    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]: n
    
    
    Enable www to non-www redirection [y/N]: y
    
  5. ツールの実施内容が出力されるので、内容を確認し、問題無ければ「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: 
    chibinfra-techlab.com www.chibinfra-techlab.com
    3. Configure a cron job to automatically renew the certificate each month
    4. Configure web server name to: chibinfra-techlab.com
    5. Enable HTTP to HTTPS redirection (example: redirect 
    http://chibinfra-techlab.com to https://chibinfra-techlab.com)
    6. Enable www to non-www redirection (example: redirect 
    www.chibinfra-techlab.com to chibinfra-techlab.com)
    7. Start web server once all changes have been performed
    
    
    Do you agree to these changes? [Y/n]: Y
    
  6. Eメールアドレスの入力が求められるので任意のアドレスを入力する。その後、Let's Encryptの購読契約に同意しますか?と聞かれるので「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: chibinfra-techlab.com www.chibinfra-techlab.com
    
    Server name: chibinfra-techlab.com
    
    E-mail address []: chibiharujijimasa@gmail.com
    
    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
    
  7. ツールが実行されます。「Success」と表示されたら無事処理が完了したことになります。

    ----------------------------------------------------------------------------
    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/apache/conf/httpd.conf.back.202403150419
    * /opt/bitnami/apache/conf/bitnami/bitnami.conf.back.202403150419
    * /opt/bitnami/apache/conf/bitnami/bitnami-ssl.conf.back.202403150419
    * /opt/bitnami/apache/conf/vhosts/wordpress-https-vhost.conf.back.202403150419
    * /opt/bitnami/apache/conf/vhosts/wordpress-vhost.conf.back.202403150419
    
    Find more details in the log file:
    
    /tmp/bncert-202403150419.log
    
    If you find any issues, please check Bitnami Support forums at:
    
    https://github.com/bitnami/vms
    
    Press [Enter] to continue:
    

3. 参考

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0