Open xzhuz opened 6 years ago
Attempting to renew cert (meisen.pro) from /etc/letsencrypt/renewal/meisen.pro.conf produced an unexpected error: Problem binding to port 80: Could not bind to IPv4 or IPv6.. Skipping. All renewal attempts failed. The following certs could not be renewed:
To fix these errors, please make sure that your domain name was entered correctly and the DNS A/AAAA record(s) for that domain contain(s) the right IP address.
重点: certbot --nginx 之前一定要停止nginx
https://meisen.pro/article/b49fd0ab40d94b4ea7f05332a3d67264
说明
如果大家现在使用的Google Chrome或Safari浏览器,那么大家可以在浏览器地址栏最左边的一把绿色的小锁。这个小锁标志说明你正在通过安全的Http协议访问该网站。如果访问没有使用SSL加密的HTTP网站,则会被浏览器标记不安全。当然,大家都不希望出现这种情况,所以接下来,我就来将Http升级到Https吧。
本小站使用Certbot来升级Https,使用Certbot升级Https是很简单的,只需要跟着官方User Guide执行一连串指令即可。先说说我升级Https的网站部署环境,我的网站部署在Ubuntu16.04 的Nginx服务器上。说了这么多,下面我就要开始了。
安装Certbot
要使用Certbot升级Https,最开始就是安装Certbot。
以上的指令相信经常使用Linux的同学已经很熟悉了吧。所以我们就直接进行下一步。
升级Https
这一行指令执行完之后,我们会得到一个certificate,并且cerbot会自动配置你的nginx配置文件
nginx.conf
,当然了你也可以手动配置你的nginx。更新证书
Let's Encrypt的certificates有效期只有90天,所以需要定时更新证书。更新证书就执行以下指令。
想要偷懒的话,可以只用自动更新的指令。
问题
和之前在服务器上配置Nginx一样,总是没有一帆风顺的事情。做完事情要学会总结,我就来总结一下这次升级过程中我所遇到的问题吧。
问题一: 执行certbot —nginx报错
问题核心描述: nginx: [error] invalid PID number "" in "/run/nginx.pid"
问题解决办法:
1)可以指定nginx.conf 文件启动
nginx -c /../nginx.conf
2)简单粗暴:将pid放到
/run/nginx.pid
. 通过ps -ef | grep nginx
获取pid,echo 12137 >> /run/nginx.pid
。问题二: 跟着官方文档配置不成功
出现这个问题,我好方
问题核心描述: 跟着官方文档指令配置不成功
问题解决办法:
使用Certbot升级https不成功,那么换一个方式,我们使用certbot-auto
安装好了之后,就可以直接安装了
执行这个指令的时候,我则是出现了报错。
事情总是有解决办法的。
总结
以上则是我这次升级Https的历程,记录了当时遇到的一些错误,这里也将这些错误贴出来给大家作为参考。最后,如果大家有什么问题请大家在下方指出评论。
转载请说明出处