Apache2 https配置

vi /etc/apache2/sites-available/default-ssl.conf

1、添加证书信息

      SSLEngine on

      #   A self-signed (snakeoil) certificate can be created by installing

      #   the ssl-cert package. See

      #   /usr/share/doc/apache2/README.Debian.gz for more info.

      #   If both key and certificate are stored in the same file, only the

      #   SSLCertificateFile directive is needed.

  #     SSLCertificateFile      /etc/ssl/certs/ssl-cert-snakeoil.pem

  #     SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

  SSLCertificateFile      /etc/letsencrypt/live/你的证书目录/fullchain.pem

  SSLCertificateKeyFile /etc/letsencrypt/live/你的证书目录/privkey.pem

2、运行命令a2enmod  ssl 开启SSL模块很重要 /关闭a2dismod ssl

3、运行命令a2ensite default-ssl.conf启用ssl站点很重要

4、重启Apache2或者 service apache2 reload

5、apachectl configtest   # 检查apache配置是否正确

百度大模型

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

腾讯云图