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

前言:

    默认安装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
如果内容对您有所帮助,就支持一下吧!
点赞0 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容