安装https免费证书
基于Let’s Encrypt的开源启用https的解决方案
安装EPEL(企业Linux额外包)
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
启用可选通道
yum -y install yum-utils
yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional
安装Certbot
sudo yum install certbot python2-certbot-nginx
选择运行Certbot的方式
获取并安装证书
运行此命令以获取证书并让Certbot自动编辑您的Nginx配置以便为其提供服务,只需一步即可启用HTTPS访问。
sudo certbot --nginx
或者,只需获得证书
如果希望手动更改Nginx配置,运行此命令
sudo certbot certonly --nginx
设置自动续订
将cron作业添加到默认的crontab
echo“0 0,12 * * * root python -c'import random; import time; time.sleep(random.random()* 3600)'&& certbot renew”| sudo tee -a / etc / crontab> / dev / null
确认Certbot有效
要确认您的网站设置正确,请在浏览器中访问https://yourwebsite.com/
,然后在网址栏中查找锁定图标
相关链接
</article>