Nginx在Mac OS X Lion上安装。找不到PCRE

时间:2012-01-22 17:45:05

标签: nginx osx-lion pcre

首先,我正在尝试编译源代码的所有内容,我没有使用MacPorts或HomeBrew。

我已将pcre安装到/usr/local/pcre-8.21并将其符号链接到/usr/local/pcre

我已将/usr/local/pcre/bin设置为我的PATH变量。

`/usr/local:/usr/local/mysql/bin:/usr/local/pcre/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin`

我现在正在尝试安装Nginx,但我不断收到此消息:

./configure: error: the HTTP rewrite module requires the PCRE library. You can either disable the module by using --without-http_rewrite_module option, or install the PCRE library into the system, or build the PCRE library statically from the source with nginx by using --with-pcre=<path> option.

我尝试设置--with-pcre=/usr/local/pcre/bin,但它只是尝试重新安装PCRE。

任何人都可以帮我解决这个问题吗? 感谢。

3 个答案:

答案 0 :(得分:12)

Nginx需要PCRE - Perl兼容的正则表达式(http://www.pcre.org/

下载PCRE并安装PCRE:

cd pcre-8.01
./configure --prefix=/usr/local
make
sudo make install

在nginx文件夹中输入以安装:

cd nginx-0.8.33
./configure --prefix=/usr/local --with-http_ssl_module
make
sudo make install

答案 1 :(得分:2)

答案可能已经找到,但我仍然想补充一下答案。 当你使用./configure时,你应该使用--with-pcre = / path / to / pcre / source。所以,让我们说源代码保存在/ usr / local / src / pcre中,然后命令将如下所示:

./configure --with-pcre=/usr/local/src/pcre

希望这有助于某人!

答案 2 :(得分:1)

我遇到了同样的问题。这些命令解决了我的问题:

打开MAC终端并运行此命令:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null

然后运行:

brew install pcre

完成!

来源:http://macappstore.org/pcre-2/