证书网站
https://letsencrypt.org/zh-cn/getting-started/
点击访问certbot,选择对应容器以及系统版本
查看系统版本
uname -a
我这里是centos 7
选完之后下面会有提示
安装snapd
1.首先安装COPR插件和EPEL,通过添加epel存储库并安装copr yum插件来启动安装,运行如下命令:
yum -y install epel-release
yum -y install yum-plugin-copr
2.然后添加repo:
yum copr enable ngompa/snapcore-el7
3.添加存储库后,安装snapd软件包,运行以下命令:
systemctl enable --now snapd.socket
4.限制需要从/snap到/var/lib/snapd/snap下的/snap或符号链接下的snaps,为它创建一个符号链接,如下命令:
ln -s /var/lib/snapd/snap /snap
安装完成
配完直接使用snap可能会碰到这个问题,稍等下就好
error: too early for operation, device not yet seeded or device model not acknowledged
使用snap下载速度可能会很慢,可以自行翻墙或者使用加速器
安装certbot
按照下列操作继续
第七步时可能会出现以下问题
1.Saving debug log to /var/log/letsencrypt/letsencrypt.log.The nginx plugin is not working; there may be problems with your existing configuration.
The error was: NoInstallationError(“Could not find a usable ‘nginx’ binary. Ensure nginx exists, the binary is executable, and your PATH is set correctly.”)
相当于window的环境变量,nginx不能直接访问到,需要配置软链接。
执行which nginx
将nginx链接到以下任意地址即可,前面是自己的安装路径,后面是要链到的路径
ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/nginx
2.The nginx plugin is not working; there may be problems with your existing configuration.The error was: PluginError(‘Nginx build is missing SSL module (–with-http_ssl_module).’)
nginx没有启用http_ssl_module模块
到nginx的源文件目录,执行
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
然后make
make
查看状态(注意不要直接nginx -V,因为之前链接了根路径,直接nginx命令会找到之前的),我当前在源文件目录,不在的自行加上全路径
objs/nginx -V
出现图片内容即可
然后备份之前的nginx
cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
将新编译出来的nginx替换原来的
cp objs/nginx /usr/local/nginx/sbin/nginx
下面按需执行即可