其他分享
首页 > 其他分享> > let's encrypt配置SSL

let's encrypt配置SSL

作者:互联网

目的

用Apache和let's encrypt配置SSL

版本

Debian 9

Apache 2.4

配置顺序

开启socache_shmcb和ssl模块

$ sudo a2enmod socache_shmcb
$ sudo a2enmod ssl

生成SSL证书

下面命令生成证书。

$ sudo certbot certonly --webroot -w /var/www/html -d hogehoge.info

生成的证书的存放地址写在“IMPORTANT NOTES:”的下面。

例如:

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/hogehoge.info/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/hogehoge.info/privkey.pem
(接续)

修改conf文件

debian版apache的conf在/etc/apache2/sites-enabled/目录。
写这个项目在<VirtualHost *:443>的下面

例如:

<VirtualHost *:443>
ServerAdmin hoge@hoge.com
DocumentRoot /var/www/html

ServerName hogehoge.info
ServerAlias 192.168.xx.xx

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

SSLEngine on
SSLCertificateFile  /etc/letsencrypt/live/hogehoge.info/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/hogehoge.info/privkey.pem
</VirtualHost>

重启Apache

$ sudo service apache2 restart 

标签:info,hogehoge,SSL,etc,live,pem,letsencrypt,let,encrypt
来源: http://blog.51cto.com/13853768/2351523