天天看點

nginx和pcre錯誤問題

CentOS 6.4 x86_64系統,編譯安裝nginx 1.4.5。

./configure時先是提示需要pcre的lib檔案。用rpm -qa | grep pcre看了一下,pcre-7.8-6.el6.x86_64是已經安裝過的。

于是用--with-pcre=/lib64指定了pcre的.so檔案路徑。但是在make的時候提示如下錯誤

make -f objs/Makefile 

make[1]: Entering directory `/usr/local/src/nginx-1.4.5′ 

cd /usr/local/pcre / 

       && if [ -f Makefile ]; then make distclean; fi / 

       && CC="gcc" CFLAGS="-O2 -fomit-frame-pointer -pipe " / 

       ./configure –disable-shared 

/bin/sh: line 2: ./configure: No such file or directory 

make[1]: *** [/usr/local/pcre/Makefile] Error 127 

make[1]: Leaving directory `/usr/local/src/nginx-1.4.5′ 

make: *** [build] Error 2

用./configure --help看了一下,原來“--with-pcre=”參數要指定的是源碼檔案。百度了一下也有說是要下個pcre的源碼包指定路徑過去。

我覺得既然已經安裝過一個pcre了,還要在編譯安裝一個實在有點兒蛋疼。。是以自己倒騰了一下,發現其實并不用再找源碼包編譯,隻要把pcre-devel裝上就OK。安裝完成後,./configure參數改成--with-pcre,不要=和後面的路徑。

還有SSL的支援也是需要openssl-devel的。(這個yum裝把,用rpm會被依賴關系搞到蛋疼)

總結一下,nginx編譯安裝基本上需要以下幾個東東:

1.gcc-----------------必不可少的

2.zlib-----------------gzip需要

3.openssl(包括openssl-devel)-----SSL支援需要

4.pcre(包括pcre-devel)--------讓nginx支援正規表達式

我最後用的./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-pcre --with-http_ssl_module

看到以下顯示這一步就成功了

Configuration summary

 + using system PCRE library

 + using system OpenSSL library

 + md5: using OpenSSL library

 + sha1: using OpenSSL library

 + using system zlib library

繼續閱讀