概要
最近在折腾自己的网站时,每次访问浏览器,左上角都有一个“不安全”提示,看起来十分不爽。于是就查了一下有没有比较好的解决办法,发现有一款很好用的开源、免费的SSL认证的工具Let’s Encrypt,可以提供免费的SSL证书,配置完发现确实比较好用(实际上,如果网站未安装SSL证书,从某些安全性要求比较高的网络访问时,可能都打不开),就记录一下,给有需要的好兄弟参考借鉴!
下面的实操要求有服务器、域名,如果是境内网站,还需要ICP备案等,这些全部都OK了,可以接着往下看。
配置流程
前置检查
本文实操环境是:CentOS 7.9 + Nginx,使用的是腾讯云提供的云服务器。
如果已经安装过nginx,请通过执行命令 nginx -V,检查是否有 configure arguments: --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module输出,如果没有,后面配置nginx时会有问题,需要重新安装。这里先把nginx服务停掉:
# 检查nginx服务是否还在运行
ps -ef | grep nginx
# 如果还在后台运行,停掉nginx服务
service nginx stop
如果还没有安装nginx或者,上述检查没有开启ssl module编译选项,需要重新安装一下nginx:
# 1. cd到nginx-1.18.0源码 (文末提供下载方式)
# [root@localhost-centos nginx-1.18.0]# ls
# auto CHANGES CHANGES.ru conf configure contrib html LICENSE Makefile man objs README src
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
make && make install
安装完毕后,执行命令检查
[root@localhost-centos nginx-1.18.0]# /usr/local/sbin/nginx -V
nginx version: nginx/1.18.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module

6286

被折叠的 条评论
为什么被折叠?



