location / { root /usr/local/openresty/nginx/html; index index.html index.htm; }
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/local/openresty/nginx/html; }
location /clusterinfo { content_by_lua ' local cjson = require "cjson"
local upstream = require "ngx.upstream" local get_servers = upstream.get_servers local get_upstreams = upstream.get_upstreams
-- get all upstream config block local function get_all_upstream() local us = get_upstreams() local upstreams = {} for _, u in ipairs(us) do local srvs = get_servers(u) upstreams[u] = srvs end return upstreams end
local upstream = require "ngx.upstream" local get_servers = upstream.get_servers local get_upstreams = upstream.get_upstreams
-- get all upstream config block local function get_all_upstream() local us = get_upstreams() local upstreams = {} for _, u in ipairs(us) do local srvs = get_servers(u) upstreams[u] = srvs end return upstreams end
local upstream = require "ngx.upstream" local get_servers = upstream.get_servers local get_upstreams = upstream.get_upstreams
-- get all upstream config block local function get_all_upstream() local us = get_upstreams() local upstreams = {} for _, u in ipairs(us) do local srvs = get_servers(u) local servers = {} for i,s in ipairs(srvs) do servers[i]=s["addr"] end upstreams[u] = servers end return upstreams end