nginx+lua问题,无法得到返回参数,始终报500
lua吧
全部回复
仅看楼主
level 2
这个访问 另一台服务器的nginx+lua 脚本 始终是抱着个错,但是 另一台的脚本已经执行了。
贴一下我的配置
local uri_args = ngx.req.get_uri_args()
local productId = uri_args["productId"]
local hosts = {"192.168.0.99", "192.168.0.98"}
local hash = ngx.crc32_long(productId)
local index = (hash % 2) + 1
backend = "http://"..hosts[index]
local requestPath = uri_args["requestPath"]
requestPath = "/"..requestPath.."?productId="..productId
local http = require("resty.http")
local httpc = http.new()
local resp, err = httpc:request_uri(backend,{
method = "GET",
path = requestPath
})
ngx.say(resp.body)
httpc:close()
不知道什么错。求大佬。。。。
2018年09月27日 08点09分 1
level 2
手动置顶
2018年09月27日 09点09分 2
level 10
在nginx 配置里有一行是,设置错误输出的路径,也就是将错误流重定向到那个路径对应的文件。打开那个文件你能看到所有错误信息
2018年09月28日 18点09分 3
1