lua 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 location = /reqq { default_type text/plain; content_by_lua_block { ngx.req.read_body() local data = ngx.req.get_body_data() local args, err = ngx.req.get_uri_args() if not args then ngx.say('post fail') return end for key,v in pairs(args) do ngx.say(key,"::",v,"--") end ngx.say(data) } } ngx.exec 内部重定向 lua 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 location = /bb { default_type text/plain; content_by_lua_block{ ngx.exec('/reqq?m=DaoShengPay3&c=Pay&orderNo=PH201910111') } } location = /reqq { default_type text/plain; content_by_lua_block { ngx.req.read_body() local data = ngx.req.get_body_data() local args, err = ngx.req.get_uri_args() if not args then ngx.say('post fail') return end for key,v in pairs(args) do ngx.say(key,"::",v,"--") end ngx.say(data) } } ngx.log lua 1 2 3 4 5 6 7 location = /testlog { default_type text/plain; content_by_lua_block{ ngx.say('hello lua log') ngx.log(ngx.ERR, 'print hello lua log') } } text 1 2019/10/12 22:25:31 [error] 468#0: *248 [lua] content_by_lua(nginx.conf:44):3: print hello lua log, client: 203.90.247.72, server: test111.hou2008.com, request: "GET /testlog HTTP/1.1", host: "test111.hou2008.com:8181", referrer: "http://test111.hou2008.com/testlog" Nginx API for Lua https://github.com/openresty/lua-nginx-module https://www.zifangsky.cn/1024.html