您的位置:首页 > 运维架构 > Nginx

nginx 编译 问题

2015-10-29 10:11 831 查看
一、configure编译没有zlib library问题

在nginx中我们执行“./configure” 会提示



意思是告诉我们没有zlib library的支持了 碰到此类问题我们只要安装这个库就可以。

下载后,解包,并进入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

三、无法找到[b]libpcre.so.1问题[/b]

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)

[b]我们需要加一个链接[/b]

解决方法:
ln -s /usr/local/lib/libpcre.so.1 /lib64


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  nginx 安装 zlib