LoginSignup
1
0

More than 3 years have passed since last update.

Ubuntu + Apache + SSL + デジタル証明書 (2.SSL編)

Last updated at Posted at 2020-06-13

作業日:2020年6月

Ubuntu + Apache + SSL + デジタル証明書 (1.Apache編)
Ubuntu + Apache + SSL + デジタル証明書 (2.SSL編) ←本編です。
Ubuntu + Apache + SSL + デジタル証明書 (3.デジタル証明書編)

Apache2でTLS/SSLを利用するには、mod_sslモジュールが必要となるのでmod_sslを有効にします。

$ sudo a2enmod ssl
Considering dependency setenvif for ssl:
Module setenvif already enabled
Considering dependency mime for ssl:
Module mime already enabled
Considering dependency socache_shmcb for ssl:
Enabling module socache_shmcb.
Enabling module ssl.
See /usr/share/doc/apache2/README.Debian.gz on how to configure SSL and create self-signed certificates.
To activate the new configuration, you need to run:
  systemctl restart apache2

default-sslサイトを有効にします。

$ sudo a2ensite default-ssl
Enabling site default-ssl.
To activate the new configuration, you need to run:
  systemctl reload apache2

Apacheを再起動してここまでの設定を有効にします。

$ sudo systemctl restart apache2

httpsプロトコルが有効化されていることを確認しておきます。

$ ss -atl
State    Recv-Q    Send-Q        Local Address:Port         Peer Address:Port
LISTEN   0         128           127.0.0.53%lo:domain            0.0.0.0:*
LISTEN   0         128                 0.0.0.0:ssh               0.0.0.0:*
LISTEN   0         128                       *:http                    *:*
LISTEN   0         128                    [::]:ssh                  [::]:*
LISTEN   0         128                       *:https                   *:*

ファイヤウォールの設定を変更してTTL/SSL(443番ポート)を開きます。

$ sudo ufw allow 'Apache full'
Rule added
Rule added (v6)

Apache Fullとなったことを確認します。

$ sudo ufw status numbered
Status: active

     To                         Action      From
     --                         ------      ----
[ 1] 80/tcp                     ALLOW IN    Anywhere
[ 2] 22/tcp                     LIMIT IN    Anywhere
[ 3] Apache Full                ALLOW IN    Anywhere
[ 4] 80/tcp (v6)                ALLOW IN    Anywhere (v6)
[ 5] 22/tcp (v6)                LIMIT IN    Anywhere (v6)
[ 6] Apache Full (v6)           ALLOW IN    Anywhere (v6)

Ubuntu + Apache + SSL + デジタル証明書 (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