Debian 11.2にSSL証明書を設定する方法

環境
OSバージョンを確認します

# cat /etc/debian_version
11.2

apache2バージョンを確認します

# apache2 -v
Server version: Apache/2.4.53 (Debian)
Server built: 2022-03-14T16:28:35

操作方法
1.SSL関連設定を設定します
# nano /etc/apache2/sites-available/default-ssl.conf
3行目
修正前
ServerAdmin webmaster@localhost
修正後
ServerAdmin contact@arkgame.com

32行目、33行目
修正前

SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

修正後

SSLCertificateFile /etc/ssl/private/server.crt
SSLCertificateKeyFile /etc/ssl/private/server.key

2.設定ファイルを有効します

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

3.sslを有効します

# 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

4.apache2を再起動します

# systemctl restart apache2

 

Debian 11

Posted by arkgame