一、问题描述
在linux安装nginx版本没有安装成功,报出一连串的环境变量关键词没有找到,如“...checking for sys/filio.h ... not found...not found.../dev/poll ... not found..kqueue..crypt()..F_READAHEAD..F_NOCACHE../usr/include/pcre/.../configure: error: the HTTP rewrite module requires the PCRE library...You can either disable the module by using --without-http_rewrite_module”,具体如下所示
web@jq22539:~/nginx-1.9.9$ ./configure @b@checking for OS@b@ + Linux 3.2.0-4-amd64 x86_64@b@checking for C compiler ... found@b@ + using GNU C compiler@b@ + gcc version: 4.7.2 (Debian 4.7.2-5) @b@checking for gcc -pipe switch ... found@b@checking for gcc builtin atomic operations ... found@b@checking for C99 variadic macros ... found@b@checking for gcc variadic macros ... found@b@checking for unistd.h ... found@b@checking for inttypes.h ... found@b@checking for limits.h ... found@b@checking for sys/filio.h ... not found@b@checking for sys/param.h ... found@b@checking for sys/mount.h ... found@b@checking for sys/statvfs.h ... found@b@checking for crypt.h ... found@b@checking for Linux specific features@b@checking for epoll ... found@b@checking for EPOLLRDHUP ... found@b@checking for O_PATH ... not found@b@checking for sendfile() ... found@b@checking for sendfile64() ... found@b@checking for sys/prctl.h ... found@b@checking for prctl(PR_SET_DUMPABLE) ... found@b@checking for sched_setaffinity() ... found@b@checking for crypt_r() ... found@b@checking for sys/vfs.h ... found@b@checking for nobody group ... not found@b@checking for nogroup group ... found@b@checking for poll() ... found@b@checking for /dev/poll ... not found@b@checking for kqueue ... not found@b@checking for crypt() ... not found@b@checking for crypt() in libcrypt ... found@b@checking for F_READAHEAD ... not found@b@checking for posix_fadvise() ... found@b@checking for O_DIRECT ... found@b@checking for F_NOCACHE ... not found@b@checking for directio() ... not found@b@checking for statfs() ... found@b@checking for statvfs() ... found@b@checking for dlopen() ... not found@b@checking for dlopen() in libdl ... found@b@checking for sched_yield() ... found@b@checking for SO_SETFIB ... not found@b@checking for SO_REUSEPORT ... not found@b@checking for SO_ACCEPTFILTER ... not found@b@checking for TCP_DEFER_ACCEPT ... found@b@checking for TCP_KEEPIDLE ... found@b@checking for TCP_FASTOPEN ... not found@b@checking for TCP_INFO ... found@b@checking for accept4() ... found@b@checking for eventfd() ... found@b@checking for int size ... 4 bytes@b@checking for long size ... 8 bytes@b@checking for long long size ... 8 bytes@b@checking for void * size ... 8 bytes@b@checking for uint64_t ... found@b@checking for sig_atomic_t ... found@b@checking for sig_atomic_t size ... 4 bytes@b@checking for socklen_t ... found@b@checking for in_addr_t ... found@b@checking for in_port_t ... found@b@checking for rlim_t ... found@b@checking for uintptr_t ... uintptr_t found@b@checking for system byte ordering ... little endian@b@checking for size_t size ... 8 bytes@b@checking for off_t size ... 8 bytes@b@checking for time_t size ... 8 bytes@b@checking for setproctitle() ... not found@b@checking for pread() ... found@b@checking for pwrite() ... found@b@checking for pwritev() ... found@b@checking for sys_nerr ... found@b@checking for localtime_r() ... found@b@checking for posix_memalign() ... found@b@checking for memalign() ... found@b@checking for mmap(MAP_ANON|MAP_SHARED) ... found@b@checking for mmap("/dev/zero", MAP_SHARED) ... found@b@checking for System V shared memory ... found@b@checking for POSIX semaphores ... not found@b@checking for POSIX semaphores in libpthread ... found@b@checking for struct msghdr.msg_control ... found@b@checking for ioctl(FIONBIO) ... found@b@checking for struct tm.tm_gmtoff ... found@b@checking for struct dirent.d_namlen ... not found@b@checking for struct dirent.d_type ... found@b@checking for sysconf(_SC_NPROCESSORS_ONLN) ... found@b@checking for openat(), fstatat() ... found@b@checking for getaddrinfo() ... found@b@checking for PCRE library ... not found@b@checking for PCRE library in /usr/local/ ... not found@b@checking for PCRE library in /usr/include/pcre/ ... not found@b@checking for PCRE library in /usr/pkg/ ... not found@b@checking for PCRE library in /opt/local/ ... not found@b@@b@./configure: error: the HTTP rewrite module requires the PCRE library.@b@You can either disable the module by using --without-http_rewrite_module@b@option, or install the PCRE library into the system, or build the PCRE library@b@statically from the source with nginx by using --with-pcre=<path> option.
二、解决步骤
通过在线和离线两种不同方式分别进行安装pcre、openssl,具体如下
1、pcre-8.34安装
方法一、在线方式安装
[root@raid2t soft]# wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz@b@--2018-08-24 01:33:11-- http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz@b@正在解析主机 downloads.sourceforge.net... 216.105.38.13@b@。。。@b@pcre-8.35/pcre16_valid_utf16.c@b@pcre-8.35/pcre32_ucd.c@b@pcre-8.35/makevp_l.txt@b@@b@[root@raid2t soft]# tar zxvf pcre-8.35.tar.gz@b@pcre-8.35/@b@pcre-8.35/pcre_scanner.h@b@pcre-8.35/LICENCE@b@pcre-8.35/makevp_c.txt@b@pcre-8.35/PrepareRelease@b@pcre-8.35/RunTest.bat@b@。。。@b@@b@[root@raid2t soft]# cd pcre-8.35@b@@b@[root@raid2t pcre-8.35]# ./configure@b@checking for a BSD-compatible install... /usr/bin/install -c@b@。。。@b@ Link pcretest with libreadline .. : no@b@ Valgrind support ................ : no@b@ Code coverage ................... : no@b@@b@[root@raid2t pcre-8.35]# make && make install@b@rm -f pcre_chartables.c@b@ln -s ./pcre_chartables.c.dist pcre_chartables.c@b@make all-am @b@ 。。。@b@ make[2]: Leaving directory '/home/soft/pcre-8.35'@b@make[1]: Leaving directory '/home/soft/pcre-8.35'
方法二、离线安装,安装pcre-8.34.tar.gz脚本,先下载安装pcre(pcre-8.34.tar.gz),安装步骤脚本如下
# tar zxvf pcre-8.34.tar.gz @b@ @b@# cd pcre-8.34 @b@ @b@#./configure @b@ @b@# make && make install
2.安装openssl
[root@raid2t nginx-1.6.3]# yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel@b@已加载插件:fastestmirror, refresh-packagekit@b@设置安装进程@b@Loading mirror speeds from cached hostfile@b@。。。@b@已安装:@b@ libtool.x86_64 0:2.2.6-15.5.el6 @b@ openssl-devel.x86_64 0:1.0.1e-57.el6 @b@ zlib-devel.x86_64 0:1.2.3-29.el6 @b@@b@作为依赖被安装:@b@ autoconf.noarch 0:2.63-5.1.el6 @b@ 。。。@b@@b@更新完毕:@b@ openssl.x86_64 0:1.0.1e-57.el6 @b@@b@作为依赖被升级:@b@ e2fsprogs.x86_64 0:1.41.12-24.el6 @b@ e2fsprogs-libs.x86_64 0:1.41.12-24.el6 @b@ krb5-libs.x86_64 0:1.10.3-65.el6 @b@ libcom_err.x86_64 0:1.41.12-24.el6 @b@ libss.x86_64 0:1.41.12-24.el6
3. 离线安装-安装openssl-1.0.0.e.tar.gz脚本,下载openssl(openssl-1.0.0e.tar.gz)包
# tar zxvf openssl-1.0.1j.tar.gz @b@ @b@# cd openssl-1.0.1j @b@ @b@#./config @b@ @b@# make && make install