ZeroBraneStudio 无法连接本地的 openresty

我按照网站上的步骤。这是我的 nginx conf(nginx 配置文件)

http {
 underscores_in_headers on;
 lua_package_path '/opt/luapoc/lua/?.lua;/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/lualibs/?/?.lua;/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/lualibs/?.lua;;';
 lua_package_cpath '/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/bin/clibs/?.dylib;;';
 init_by_lua_block{
   num = require("numbers")
   data = num.getrandom()
   if data then
   ngx.log(ngx.DEBUG, "data is" .. data)
   end
 }

numbers.lua

require('mobdebug').start("192.168.1.155")

local M={}
function M.getrandom()
print("random function called") -- 我在这里放了一个断点。
return math.random()
end
return M

我拿了我的 IP 地址我的 ifconfg(ifconfig 命令的输出) inetaddress。

我去到 ZBS,将项目目录从 numbers 文件设置。然后通过项目 -> 启动调试器服务器启动调试。

尽管我在 require('mobdebug').start("192.168.1.155") 中给出了 IP 地址,但它仍在本地启动调试服务器。

我正在启动 nginx,并期望在我在 numbers.lua 中放置的断点处停止流程,但它没有。

任何想法是什么原因导致 ZBS 无法接收调试信号?

点赞
用户1442917
用户1442917

请确保在 IDE 中通过 Project | Start Debugger Server 命令启动调试器服务器。由于在某些系统上启动时会产生防火墙警告,因此此功能默认情况下是禁用的。也可以使用 AutoStartDebug 插件 将其设为默认启用。

如果仍无法解决问题,请尝试在命令行中运行相同的脚本,而非通过 nginx 进行运行,以查看是否能在命令行中正常工作。

2017-09-29 01:54:49