Apache2 https配置

一、修改配置文件

/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/yourdomain.com/fullchain.pem

  SSLCertificateKeyFile /etc/letsencrypt/live/yourdomain.com/privkey.pem

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

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

四、重启Apache2或者 service apache2 reload

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

百度大模型

发表回复

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

腾讯云图