编译安装nginx出错:the HTTP rewrite module requires the PCRE library.

来源:互联网 发布:蓝光播放器网络排名 编辑:程序博客网 时间:2024/05/16 10:28

在suse linux下编译安装nginx中执行./configure这一步时出现如下错误:

...

checking for PCRE library ... not found
checking for PCRE library in /usr/local/ ... not found
checking for PCRE library in /usr/include/pcre/ ... not found
checking for PCRE library in /usr/pkg/ ... not found
checking for PCRE library in /opt/local/ ... not found

./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.

很明显是系统没有安装PRCE这个库,于是我赶紧执行“zypper in pcre”来在线安装,最后总因为各种依赖关系和软件包的版本问题安装不成功。然后我根据错误提示,忽略这个依赖包,发现还是不成功。眼看只有最后个法子了:build the PCRE library statically from the source with nginx by using --with-pcre=<path> option.问题是我根本没有pcre这个库文件,怎么手动指定?


静下心来,再看看前面的提示:

checking for PCRE library ... not found

……

程序分别去/usr/local/、/usr/include/pcre等几个固定的路径去查找pcre libary,没找到会不会因为pce libary在其他位置呢?顺着这个思路,我执行全盘扫描所有与pcre的文件:

find / -name pcre

结果如下:

/usr/include/pcre
/root/software/nginx-1.7.7/auto/lib/pcre

第二个路径是在nginx源文件的内部路径,我顿时一惊,原来nginx自带了pcre库文件 !我的天!!(初涉linux,请见谅)

于是执行 ./configure --width-pcre=/root/software/nginx-1.7.7/auto/lib/pcre/,结果如下:

....

checking for md5 in system md library ... not found
checking for md5 in system md5 library ... not found
checking for md5 in system OpenSSL crypto library ... not found
checking for sha1 in system md library ... not found
checking for sha1 in system OpenSSL crypto library ... not found
checking for zlib library ... not found


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

现在已经没有提示缺少pcre library的错误,说明前面的方法开始奏效,我又全盘搜索,找到zlib库所有的位置并在安装时指定它的位置:

./configure --with-pcre=/root/software/nginx-1.7.7/auto/lib/pcre/ --with-zlib=/root/software/nginx-1.7.7/auto/lib/zlib

结果没有错误了,最后顺势执行make、make install,ok,搞定。


0 0
原创粉丝点击