Nginx 是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP服务器,它具有很多非常优越的特性:能够支持高达 50,000 个并发连接数的响应,中国大陆使用nginx网站用户有:百度、京东、新浪、网易、腾讯、淘宝等。本站素文宅www.yoodb.com在linux系统中下载源码安装时报./configure: error: the HTTP rewrite module requires the PCRE library.错误信息,分析原因总结如下。
下载nginx,通过远程下载执行wget http://nginx.org/download/nginx-1.3.11.tar.gz ,解压并安装执行如下:
[root@cspur nginx-1.3.11]# ./configure --prefix=/usr/local/nginx checking for OS + Linux 2.6.18-308.el5 x86_64 checking for C compiler ... found + using GNU C compiler + gcc version: 4.1.2 20080704 (Red Hat 4.1.2-52) checking for gcc -pipe switch ... found checking for gcc builtin atomic operations ... found checking for C99 variadic macros ... found checking for gcc variadic macros ... found checking for unistd.h ... found checking for inttypes.h ... found checking for limits.h ... found checking for sys/filio.h ... not found checking for sys/param.h ... found checking for sys/mount.h ... found checking for sys/statvfs.h ... found checking for crypt.h ... found checking for Linux specific features checking for epoll ... found checking for sendfile() ... found checking for sendfile64() ... found checking for sys/prctl.h ... found checking for prctl(PR_SET_DUMPABLE) ... found checking for sched_setaffinity() ... found checking for crypt_r() ... found checking for sys/vfs.h ... found checking for nobody group ... found checking for poll() ... found checking for /dev/poll ... not found checking for kqueue ... not found checking for crypt() ... not found checking for crypt() in libcrypt ... found checking for F_READAHEAD ... not found checking for posix_fadvise() ... found checking for O_DIRECT ... found checking for F_NOCACHE ... not found checking for directio() ... not found checking for statfs() ... found checking for statvfs() ... found checking for dlopen() ... not found checking for dlopen() in libdl ... found checking for sched_yield() ... found checking for SO_SETFIB ... not found checking for SO_ACCEPTFILTER ... not found checking for TCP_DEFER_ACCEPT ... found checking for TCP_KEEPIDLE, TCP_KEEPINTVL, TCP_KEEPCNT ... found checking for TCP_INFO ... not found checking for accept4() ... not found checking for int size ... 4 bytes checking for long size ... 8 bytes ... checking for sysconf(_SC_NPROCESSORS_ONLN) ... found checking for openat(), fstatat() ... found checking for getaddrinfo() ... found checking for PCRE library ... not found checking for PCRE library in /usr/local/ ... not found checking for PCRE library in /usr/include/pcre/ ... not found checking for PCRE library in /usr/pkg/ ... not found checking for PCRE library in /opt/local/ ... not found ./configure: error: the HTTP rewrite module requires the PCRE library. You can either disable the module by using --without-http_rewrite_module option, or install the PCRE library into the system, or build the PCRE library statically from the source with nginx by using --with-pcre=<path> option.
错误信息如下:
./configure: error: the HTTP rewrite module requires the PCRE library.
解决问题的办法是安装pcre-devel组件,具体执行如下:
[root@cspur nginx-1.3.11]# yum -y install pcre-devel Loaded plugins: fastestmirror, security Loading mirror speeds from cached hostfile * base: mirrors.btte.net * epel: mirrors.neusoft.edu.cn * epel-debuginfo: mirrors.neusoft.edu.cn * epel-source: mirrors.neusoft.edu.cn * extras: mirrors.btte.net * updates: mirrors.btte.net Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package pcre-devel.i386 0:6.6-9.el5 set to be updated --> Processing Dependency: pcre = 6.6-9.el5 for package: pcre-devel --> Processing Dependency: libpcreposix.so.0 for package: pcre-devel --> Processing Dependency: libpcre.so.0 for package: pcre-devel --> Processing Dependency: libpcrecpp.so.0 for package: pcre-devel ---> Package pcre-devel.x86_64 0:6.6-9.el5 set to be updated --> Running transaction check ---> Package pcre.i386 0:6.6-9.el5 set to be updated ---> Package pcre.x86_64 0:6.6-9.el5 set to be updated --> Finished Dependency Resolution ... Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Updated: openssl.i686 0:0.9.8e-40.el5_11 openssl.x86_64 0:0.9.8e-40.el5_11 openssl-devel.i386 0:0.9.8e-40.el5_11 openssl-devel.x86_64 0:0.9.8e-40.el5_11 Complete!
可能还会出现如下错误提示:
./configure: error: the HTTP cache module requires md5 functions from OpenSSL library. You can either disable the module by using --without-http-cache option, or install the OpenSSL library into the system, or build the OpenSSL library statically from the source with nginx by using --with-http_ssl_module --with-openssl=<path> options.
解决办法执行yum -y install openssl openssl-devel命令即可.
问题解决之后重新执行如下命令后,nginx安装成功。
[root@cspur nginx-1.3.11]# ./configure --prefix=/usr/local/nginx [root@cspur nginx-1.3.11]# make [root@cspur nginx-1.3.11]# make install
启动nginx执行命令:/usr/nginx/sbin/nginx