首先下载nginx,pcre,
首先安装pcre
[xxxxx@xxxxx.com]#tar zxvf pcre-7.2.tar.gz
[xxxxx@xxxxx.com]#cd pcre-7.2/
[xxxxx@xxxxx.com]#./configure
[xxxxx@xxxxx.com]#make && make install
[xxxxx@xxxxx.com]#cd ../
libtool: line 990: g++: command not found
运行 apt-get install build-essential解决
编译nginx
./configure –user=root –group=root –prefix=/home/admin/nginx –with-openssl=/usr/include/openssl –with-pcre=/usr/local/lib –with-http_stub_status_module
在这里,需要说明一下,由于Nginx的配置文件中我想用到正则,所以需要 pcre 模块的支持。上面安装步骤里我已经安装了 pcre 及 pcre-devel 的rpm包,但是 Ngxin 并不能正确找到 .h/.so/.a/.la 文件,因此我稍微变通了一下:
[xxxxx@xxxxx.com]#mkdir /usr/include/pcre/.libs/
[xxxxx@xxxxx.com]#cp /usr/local/lib/libpcre.a /usr/include/pcre/.libs/libpcre.a
[xxxxx@xxxxx.com]#cp /usr/local/lib/libpcre.a /usr/include/pcre/.libs/libpcre.la
[xxxxx@xxxxx.com]#cp /usr/local/lib/libpcre.a /usr/include/pcre/libpcre.a
[xxxxx@xxxxx.com]#cp /usr/local/lib/libpcre.a /usr/include/pcre/libpcre.la
然后,修改 objs/Makefile 大概在908行的位置上,注释掉以下内容:
./configure –disable-shared
接下来,就可以正常执行 make 及 make install 了。