Files
Jamie Curnow 4b15f1bc5e Fix lua-resty-http
Downgrade to lua 5.1.5. ngx_http_lua_module only works with 5.1
Re-add install lua-resty-http module
Adds simple test suite for http module
2026-06-02 20:56:53 +10:00

36 lines
638 B
Plaintext

server {
listen 8080;
listen [::]:8080;
server_name localhost;
location /lua {
default_type application/json;
content_by_lua_block {
local http = require("resty.http")
local httpc = http.new()
httpc:set_timeout(5000)
local res, err = httpc:request_uri("http://127.0.0.1:8080/", {
method = "GET"
})
if not res then
ngx.status = 500
ngx.say('{"ok":false,"error":"' .. (err or "unknown") .. '"}')
return
end
ngx.status = 200
ngx.say('{"ok":true,"status":' .. res.status .. ',"body":"' .. (res.body or "") .. '"}')
}
}
location / {
index index.html;
root /var/www/html;
}
}