Redhat7.4下安装nginx-1.14

 

1)yum直接安装依赖包
yum install pcre-devel pcre gcc gcc-c++ zlib-devel zlib openssl* -y   (安装依赖)
tar -zxvf nginx-1.14.1.tar.gz 
cd /software/nginx-1.14.1
adduser nginx   (添加系统用户)
./configure --prefix=/software/nginx --user=nginx --group=nginx --with-stream --with-http_ssl_module --with-http_realip_module --with-http_stub_status_module --with-http_gzip_static_module --with-http_flv_module   (根据自己需要安装相应模块和插件)
make   (编译)
make install   (安装)

2) 依赖包源码安装(默认安装的openssl、pcre等版本较低,可到官网下载较新稳定版源码去安装,安全性高点)
版本:redhat 7.4 ,zlib-1.2.8,pcre-8.34,nginx-1.14.0

[root@xsbfwbtest pcre-8.34]# ./configure
......
[root@xsbfwbtest pcre-8.34]# make
 cd . && /bin/sh /software/tools/pcre-8.34/missing automake-1.14 --gnu
/software/tools/pcre-8.34/missing: line 81: automake-1.14: command not found
WARNING: 'automake-1.14' is missing on your system.
         You should only need it if you modified 'Makefile.am' or
         'configure.ac' or m4 files included by 'configure.ac'.
         The 'automake' program is part of the GNU Automake package:
         <http://www.gnu.org/software/automake>
         It also requires GNU Autoconf, GNU m4 and Perl in order to run:
         <http://www.gnu.org/software/autoconf>
         <http://www.gnu.org/software/m4/>
         <http://www.perl.org/>
make: *** [Makefile.in] Error 1
[root@xsbfwbtest pcre-8.34]# rpm -qa | grep automake
automake-1.13.4-3.el7.noarch
[root@xsbfwbtest pcre-8.34]# rpm -qa | grep automake
automake-1.13.4-3.el7.noarch
[root@xsbfwbtest pcre-8.34]# ll -ha /usr/bin/ | grep auto
autoconf       autoheader     autom4te       automake       automake-1.13  autoreconf     autoscan       autoupdate
[root@xsbfwbtest pcre-8.34]# ln -s /usr/bin/automake-1.13 /usr/bin/automake-1.14
[root@xsbfwbtest pcre-8.34]# ln -s /usr/bin/aclocal-1.13 /usr/bin/aclocal-1.14
[root@xsbfwbtest pcre-8.34]# make
 cd . && /bin/sh /software/tools/pcre-8.34/missing automake-1.14 --gnu
configure.ac:29: error: version mismatch.  This is Automake 1.13.4,
configure.ac:29: but the definition used by this AM_INIT_AUTOMAKE
configure.ac:29: comes from Automake 1.14.  You should recreate
configure.ac:29: aclocal.m4 with aclocal and run automake again.
WARNING: 'automake-1.14' is probably too old.
         You should only need it if you modified 'Makefile.am' or
         'configure.ac' or m4 files included by 'configure.ac'.
         The 'automake' program is part of the GNU Automake package:
         <http://www.gnu.org/software/automake>
         It also requires GNU Autoconf, GNU m4 and Perl in order to run:
         <http://www.gnu.org/software/autoconf>
         <http://www.gnu.org/software/m4/>
         <http://www.perl.org/>
make: *** [Makefile.in] Error 1
[root@xsbfwbtest pcre-8.34]# cd ..
[root@xsbfwbtest pcre-8.34]# yum remove automake -y  #把系统原来的卸载
......
[root@xsbfwbtest pcre-8.34]# \rm /usr/bin/automake-1.14  #干掉刚才建的软链接
[root@xsbfwbtest pcre-8.34]# \rm /usr/bin/aclocal-1.14
[root@xsbfwbtest tools]# tar -zxvf automake-1.14.tar.gz  #下载上面报错需要的对应版本,试了不是对应版本报各种错,然后卸载make uninstall再去老老实实安装对应版本才通过,http://ftp.gnu.org/gnu/automake/
......
[root@xsbfwbtest tools]# cd automake-1.14/
[root@xsbfwbtest automake-1.14]# ./configure
.....额,又有报错,要先下载装相应依赖在继续,m4-1.4.9.tar.gz -> export PATH=$PATH:/usr/local/bin -> autoconf-2.69.tar.gz
[root@xsbfwbtest automake-1.14]# ./configure
.....
[root@xsbfwbtest automake-1.14]# make && make install
......
[root@xsbfwbtest ~]# automake --version    #重新登录下查看版本已经是1.14了 
automake (GNU automake) 1.14
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl-2.0.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Tom Tromey <tromey@redhat.com>
       and Alexandre Duret-Lutz <adl@gnu.org>.
[root@xsbfwbtest pcre-8.34]# ./configure   #进pcre目录重新编译安装,
......
[root@xsbfwbtest pcre-8.34]# make 
......
[root@xsbfwbtest pcre-8.34]# make install
......
#下面源码安装nginx,参数可以根据自己需要加上。其中pcre和zlib我用的源码安装,也可以直接yum安装
[root@xsbfwbtest nginx-1.14.0]# ./configure --prefix=/software/nginx-1.14 --user=nginx --group=nginx --with-http_stub_status_module --with-http_gzip_static_module --with-http_flv_module --with-pcre=/software/tools/pcre-8.34 --with-http_realip_module --add-module=/software/tools/nginx_upstream_check_module-master --add-module=/software/tools/nginx-sticky-module-1.1-for1.14 --with-zlib=/software/tools/zlib-1.2.8 --with-http_ssl_module --with-stream
......
Configuration summary
  + using PCRE library: /software/tools/pcre-8.34
  + using system OpenSSL library
  + using zlib library: /software/tools/zlib-1.2.8

  nginx path prefix: "/software/nginx-1.14"
  nginx binary file: "/software/nginx-1.14/sbin/nginx"
  nginx modules path: "/software/nginx-1.14/modules"
  nginx configuration prefix: "/software/nginx-1.14/conf"
  nginx configuration file: "/software/nginx-1.14/conf/nginx.conf"
  nginx pid file: "/software/nginx-1.14/logs/nginx.pid"
  nginx error log file: "/software/nginx-1.14/logs/error.log"
  nginx http access log file: "/software/nginx-1.14/logs/access.log"
  nginx http client request body temporary files: "client_body_temp"
  nginx http proxy temporary files: "proxy_temp"
  nginx http fastcgi temporary files: "fastcgi_temp"
  nginx http uwsgi temporary files: "uwsgi_temp"
  nginx http scgi temporary files: "scgi_temp"
......
[root@xsbfwbtest nginx-1.14.0]# make && make install
......
[root@xsbfwbtest conf]# vim nginx.conf   #进去刚才安装指定的目录,配置根据自己需要修改
[root@xsbfwbtest sbin]# ./nginx -t  
nginx: the configuration file /software/nginx-1.14/conf/nginx.conf syntax is ok
nginx: configuration file /software/nginx-1.14/conf/nginx.conf test is successful
[root@xsbfwbtest sbin]# ./nginx
[root@xsbfwbtest sbin]# ps -ef | grep nginx
root     24080     1  0 12:21 ?        00:00:00 nginx: master process ./nginx
nginx    24081 24080  0 12:21 ?        00:00:00 nginx: worker process
root     24086  5316  0 12:21 pts/1    00:00:00 grep --color=auto nginx
[root@xsbfwbtest sbin]#

 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值