下载后,解包,并进入nginx:
开始nginx安装:
./configure
make
make install
若在“./configure”后方加入了“--with-http_gzip_static_module”(添加gzip压缩模块)提示以下错误:
./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.
则需要安装“zlib-devel”即可。SSH执行以下命令:
代码如下 | 复制代码 |
yum install -y zlib-devel |
然后再进行nginx的编译。表示问题即可解决。
二、缺少C++编译器问题
像还有一些其它组件错误如:
You need a C++ compiler for C++ support
缺少c++编译器的原因
yum install -y gcc gcc-c++
make[1]: *** [/usr/local/pcre/Makefile] Error 127.pcre指向错误
指向源码包,不是编译安装后的包,所以
./configure –prefix=/export/lnmp/nginx-1.4.7 –with-pcre=../pcre-8.34
三、无法找到libpcre.so.1问题
nginx安装完成后,启动如果遇到如下问题:
./nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
而这个时候如果你的pcre已经安装完成,则用如下方法解决:
可用 ldd /opt/nginx-1.8/sbin/nginx 查看链接
linux-vdso.so.1 => (0x00007fff15bff000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00000036cf200000)
libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00000036d1e00000)
libpcre.so.1 => not found
libz.so.1 => /lib64/libz.so.1 (0x00000036cea00000)
libc.so.6 => /lib64/libc.so.6 (0x00000036cee00000)
/lib64/ld-linux-x86-64.so.2 (0x00000036ce600000)
libfreebl3.so => /lib64/libfreebl3.so (0x00000036d2600000)
libdl.so.2 => /lib64/libdl.so.2 (0x00000036cf600000)
如果是64位系统可去 /lib64/ 中查看libpcre.so.1是否存在
ll libpcre*
lrwxrwxrwx. 1 root root 16 Aug 14 2014 libpcre.so.0 -> libpcre.so.0.0.1
-rwxr-xr-x 1 root root 183816 Sep 7 2012 libpcre.so.0.0.1
可以发现只有libpcre.so.0 (低版本prce对应的libpcre.so.1 为libpcre.so.0)
我们需要加一个链接
解决方法:
ln -s /usr/local/lib/libpcre.so.1 /lib64