CentOS 6.4 x86_64系統,編譯安裝nginx 1.4.5。nginx
./configure時先是提示須要pcre的lib文件。用rpm -qa | grep pcre看了一下,pcre-7.8-6.el6.x86_64是已經安裝過的。正則表達式
因而用--with-pcre=/lib64指定了pcre的.so文件路徑。可是在make的時候提示以下錯誤ide
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 2ui
用./configure --help看了一下,原來「--with-pcre=」參數要指定的是源碼文件。百度了一下也有說是要下個pcre的源碼包指定路徑過去。spa
我以爲既然已經安裝過一個pcre了,還要在編譯安裝一個實在有點兒蛋疼。。因此本身倒騰了一下,發現其實並不用再找源碼包編譯,只要把pcre-devel裝上就OK。安裝完成後,./configure參數改爲--with-pcre,不要=和後面的路徑。orm
還有SSL的支持也是須要openssl-devel的。(這個yum裝把,用rpm會被依賴關係搞到蛋疼)ip
總結一下,nginx編譯安裝基本上須要如下幾個東東:md5
1.gcc-----------------必不可少的ssl
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
後面愉快的make && make install把!