在centos 5.5下安装nginx

  按理来说,装个nginx是很简单的,诸如用:yum install nginx,这个确实没什么问题,可是我想通过编译源码的方式安装,而且还要开启一些功能,诸如pcre zlib  openssl。

 

   开始把pcre(www.pcre.org),zlib(www.zlib.org,官网好像访问不了了?关门了?通过这个可以下载http://sourceforge.net/projects/libpng/files/zlib/),

openssl(www.openssl.org) 都下载,编译安装好了,然后开始编译安装nginx-0.8.53

 

   ./configure --prefix=/usr/local/nginx --user=www --group=www  --with-http_gzip_static_module --with-http_stub_status_module --with-http_ssl_module  --with-pcre=/usr/local/pcre --with-zlib=/usr/local/zlib --with-openssl=/usr/local/openssl --with-http_realip_module

   这步没什么问题,接下来make,问题出来了:

  cd /usr/local/pcre \
&& if [ -f Makefile ]; then make distclean; fi \
&& CC="gcc" CFLAGS="-O2 -fomit-frame-pointer -pipe " \
./configure --disable-shared
/bin/sh: ./configure: No such file or directory
make[1]: *** [/usr/local/pcre/Makefile] Error 127
make[1]: Leaving directory `/software/nginx-0.8.53'
make: *** [build] Error 2

   怎么捣鼓也没搞定,无意间 ./configure --help

  看一下帮助说明:

   --with-pcre=DIR                 set path to PCRE library sources

   注意:set path to PCRE library sources是让你设置到源码目录,而不是编译安装后的目录,顿时恍然大悟。

   迅速把上面几个依赖包的路径都改成源码路径:

   ./configure --prefix=/usr/local/nginx --with-http_gzip_static_module --with-http_stub_status_module --with-http_ssl_module --with-pcre=/software/pcre-8.10 --with-zlib=/software/zlib-1.2.5 --with-openssl=/software/openssl-1.0.0a --with-http_realip_module

  重新执行,OK。

   

posted @ 2010-11-22 16:09  呀呀个呸  阅读(1596)  评论(0编辑  收藏  举报