Centos7安装Letsencrypt证书 SSL证书
本文仅做记录
1,安装certbot
yum install certbot
如果出现下面的说明表示安装失败
2,如果安装失败请执行如下语句
pip uninstall requests
pip uninstall urllib3
yum remove python-urllib3
yum remove python-requests
yum install python-urllib3
yum install python-requests
yum install certbot
如果出现如下,表示安装成功
Running transaction
Installing : python-requests-toolbelt-0.8.0-3.el7.noarch 1/4
Installing : python2-acme-1.11.0-1.el7.noarch 2/4
Installing : python2-certbot-1.11.0-2.el7.noarch 3/4
Installing : certbot-1.11.0-2.el7.noarch 4/4
Verifying : certbot-1.11.0-2.el7.noarch 1/4
Verifying : python2-certbot-1.11.0-2.el7.noarch 2/4
Verifying : python-requests-toolbelt-0.8.0-3.el7.noarch 3/4
Verifying : python2-acme-1.11.0-1.el7.noarch 4/4
Installed:
certbot.noarch 0:1.11.0-2.el7
Dependency Installed:
python-requests-toolbelt.noarch 0:0.8.0-3.el7 python2-acme.noarch 0:1.11.0-1.el7 python2-certbot.noarch 0:1.11.0-2.el7
Complete!
3,关闭443端口,然后执行如下语句
certbot certonly --standalone -d www.bugkong.com -m xxxx@028888.net --agree-tos
一直按y,然后出现如下信息表示成功
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/www.bugkong.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/www.bugkong.com/privkey.pem
Your certificate will expire on 2022-07-19. To obtain a new or
tweaked version of this certificate in the future, simply run
certbot again. To non-interactively renew *all* of your
certificates, run "certbot renew"
- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le
其中 /etc/letsencrypt/live/www.bugkong.com/这个文件夹里的文件就是我们所需要的
文件表示的意思:
cert.pem 服务端证书
chain.pem 浏览器需要的所有证书但不包括服务端证书,比如根证书和中间证书
fullchain.pem 包括了cert.pem和chain.pem的内容
privkey.pem 证书的私钥
4,生成nginx需要的dhparam
openssl dhparam -out ./dhparam2048.pem 2048
5,最后在nginx中配置即可
ssl_certificate "/etc/letsencrypt/live/www.bugkong.com/fullchain.pem";
ssl_certificate_key "/etc/letsencrypt/live/www.bugkong.com/privkey.pem";
ssl_dhparam "/mysoft/temp/dhparam2048.pem";
感谢强大的网络。。。。。。
爆款云服务器s6 2核4G 低至0.46/天,具体规则查看活动详情