nginx中content_by_lua代码无法正常工作

我在nginx上实现了lua-resty-http模块,但是nginx.conf文件中的content_by_lua代码无法正常工作(即未触发)。

nginx.conf代码:

server {
location {

 content_by_lua '
        local http = require "resty.http.simple"
      local httpc = http.new()
      httpc:set_timeout(500)
      httpc:connect("127.0.0.1", 80)
        local res, err = httpc:request({
          path = "/example/sample/test",
          headers = {
              ["Host"] = "example.abc.com",
          },
      })
 ';
}
}

有什么解决办法??

点赞