Skip to content

面板安装的openresty如何集成lua-resty-upstream-healthcheck健康检查 #6041

Closed Answered by Aliang-code
Aliang-code asked this question in Q&A
Discussion options

You must be logged in to vote

好吧我是智障,lua的注释符号是--而不是#
注释掉/opt/1panel/apps/openresty/openresty/1pwaf/data/conf/waf.conflua_package_pathinit_worker_by_lua_file,使用如下配置既可

#openresty健康检查
lua_package_path "/usr/local/openresty/lualib/?.lua;/usr/local/openresty/1pwaf/?.lua;/usr/local/openresty/1pwaf/lib/?.lua;;";
lua_shared_dict healthcheck 1m;
lua_socket_log_errors off;
init_worker_by_lua_block {
    require "worker" --1panel自带WAF脚本
    local hc = require "resty.upstream.healthcheck"

    local ok, err = hc.spawn_checker{
        shm = "healthcheck", 
        upstream = "blog",      --upstream名称
        type = "http",          --健康检查请求协议
        http_req = "GET /wp-content/ HTTP/1.0\r\nHost: blog.aliang-zh.top\r\n\r\n", --…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Aliang-code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant