【问题标题】:How can I stop nginx failling over when openresty throws runtime error deploying cert当openresty抛出运行时错误部署证书时,如何阻止nginx故障转移
【发布时间】:2019-05-16 20:43:15
【问题描述】:

我们正在使用 openresty 和 lua-resty-auto-ssl 包从 Lets Encrypt 生成证书,但最近服务器不断崩溃。我猜它是在证书尝试自动更新时触发的,因为第一次生成证书工作正常......我们看到的错误是

2019/05/12 08:25:24 [error] 2623#2623: *1024227 lua entry thread aborted: runtime error: ...sty/luajit/share/lua/5.1/resty/auto-ssl/servers/hook.lua:40: assertion failed!
stack traceback:
coroutine 0:
    [C]: in function 'assert'
        ...sty/luajit/share/lua/5.1/resty/auto-ssl/servers/hook.lua:40: in function 'server'
        .../local/openresty/luajit/share/lua/5.1/resty/auto-ssl.lua:99: in function 'hook_server'
        content_by_lua(nginx.conf:194):2: in function <content_by_lua(nginx.conf:194):1>, client: 127.0.0.1, server: , request: "POST /deploy-cert HTTP/1.1", host: "127.0.0.1:8999"

从我在错误中看到的内容来看,在尝试部署证书时未能断言某些内容,这可能是 4 件事中的任何一个

assert(params["domain"])
assert(params["fullchain"])
assert(params["privkey"])
assert(params["expiry"])

我有点坚持我能做的事情,让服务器在使用时退出是没有好处的。那是服务器离线之前报告的最后一个错误,所以我猜这就是原因?但不是 100% 确定。

我是否可以在任何地方查找导致崩溃的更多信息。我是 nginx/openresty 的新手,所以有点摸不着头脑。有没有人遇到过类似的问题?

【问题讨论】:

    标签: nginx lua amazon-ami openresty


    【解决方案1】:

    将其全部包装在一个函数中,并使用pcallxpcall 调用它并添加一些逻辑来处理错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-18
      • 1970-01-01
      • 2017-01-09
      • 1970-01-01
      相关资源
      最近更新 更多