在Mac OS X上,Openresty中Lua无法正常工作。

我正在尝试在Mac OS X 10.6下安装Openresty v.1.2.6.7。我使用brew安装pcre以满足要求(pcre版本为8.32),然后使用指定的pcre目录和--with-luajit选项运行configure脚本。

cd openresty-1.2.6.7

./configure --with-cc-opt="-I/usr/local/Cellar/pcre/8.32/include" \
            --with--ld-opt="-L/usr/local/Cellar/pcre/8.32/lib" |
            --with-luajit

我正在使用Openresty指南中给出的示例配置文件:

http://openresty.org/#GettingStarted

试图使用它启动nginx,但是我遇到了以下错误:

nginx: [emerg] unknown directive "content_by_lua"

我在Ubuntu中尝试了相同的步骤(并做了先决条件软件包的必要更改),运行正常。任何建议都非常欢迎。

点赞
用户979928
用户979928

几天后,我找到了解决办法。我使用 brew 分别安装了 LuaJIT,并在构建 openresty 时使用了其库和头文件。

cd openresty-1.2.6.7

./configure --with-cc-opt="-I/usr/local/Cellar/pcre/8.32/include
                           -I/usr/local/Cellar/luajit/2.01/luajit2.0/include" \
            --with--ld-opt="-L/usr/local/Cellar/pcre/8.32/lib
                            -L/usr/local/Cellar/luajit/2.01/luajit2.0/lib" \
            --with-luajit

使用以下命令进行构建:

 make && make install

然后就可以使用了。

2013-05-01 10:41:11
用户808204
用户808204

为什么不直接使用 Brew?

brew install openresty

就这样! :)

2014-03-11 20:24:07