前言:
默认安装tenginx 后,由于 nginx -V 命令中缺乏–with-http_ssl_module 导致。一般会提议安装时加上参数重新编译解决。
本题为了避免重新编译,通过shell脚本欺骗 certbot 实现HTTPS证书签发。
原理:
certbot通过python命令执行 nginx -c /etc/nginx/nginx.conf -t ,并获取错误输出通道的记录。正则判断是否存在字符串 “ –with-http_ssl_module ”
解决办法:
1.通过which nginx 查找nginx可执行文件位置。
2.将此文件改名如 mv /bin/nginx /bin/nginx_app
3./bin/nginx替换成shell脚本 ,并增加可执行权限 chmod +x /bin/nginx
4. 执行证书签发流程 certbot –nginx
解决脚本:
#!/bin/bash
arg=$@
echo “${arg}” | grep -V
if [ $? -eq 0 ] ;then
/usr/local/nginx/sbin/nginx $@
echo –with-http_ssl_module >&2
else /usr/local/nginx/sbin/nginx $@
fi
© 版权声明
文章版权归作者所有,未经允许请勿转载。如内容涉嫌侵权,请在本页底部进入<联系我们>进行举报投诉!
THE END
















暂无评论内容