certbot 签发Tengine HTTPS证书,提示Nginx build is missing SSL module (--with-http_ssl_module).

  • 时间:2025-10-29 01:34 作者: 来源: 阅读:4
  • 扫一扫,手机访问
摘要:前言:    默认安装tenginx 后,由于 nginx -V 命令中缺乏--with-http_ssl_module 导致。一般会提议安装时加上参数重新编译解决。 本题为了避免重新编译,通过shell脚本欺骗 certbot 实现HTTPS证书签发。原理:    c

前言:

    默认安装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

  • 全部评论(0)
手机二维码手机访问领取大礼包
返回顶部