nginx系列之centos7.5离线安装nginx1.16.1

一、环境软件包准备

gcc

gcc-c+

centos7以上安装 perl5
wget https://www.cpan.org/src/5.0/perl-5.30.1.tar.gz
[root@localhost local]#tar -xzf perl-5.30.1.tar.gz
[root@localhost local]#cd perl-5.30.1
[root@localhost perl-5.30.1]#./Configure -des -Dprefix=$HOME/localperl
[root@localhost perl-5.30.1]#make
[root@localhost perl-5.30.1]#make test  #此过程费时间,可中断也可以跳过
[root@localhost perl-5.30.1]#make install

注意:若上述软件包以安装则可略过此环节。

二、依赖包安装

依赖包:openssl-1.0.2k.tar.gz、pcre-8.36.tar.gz、zlib-1.2.8.tar.gz、nginx-1.16.1.tar.gz

1.选定源码目录
选定目录 /usr/local/
cd /usr/local/

2.安装PCRE库
cd /usr/local/
[root@localhost local]#tar -zxvf pcre-8.36.tar.gz
[root@localhost local]#cd pcre-8.36
[root@localhost pcre-8.36]#./configure
[root@localhost pcre-8.36]#make && make install

3.安装zlib库
cd /usr/local/ 

wget http://zlib.net/zlib-1.2.8.tar.gz

[root@localhost local]#tar -zxvf zlib-1.2.8.tar.gz 
[root@localhost local]#cd zlib-1.2.8
[root@localhost zlib-1.2.8]#./configure
[root@localhost zlib-1.2.8]#make && make install
 
4.安装ssl

centos7以上版本建议安装openssl-1.0.1k.tar.gz 以上

cd /usr/local/

wget http://www.openssl.org/source/openssl-1.0.2k.tar.gz

[root@localhost local]#tar -zxvf openssl-1.0.2k.tar.gz
[root@localhost local]#cd openssl-1.0.2k
[root@localhost openssl-1.0.2k]#./config
[root@localhost openssl-1.0.2k]#make && make install

检查openssl
#openssl version -a
查看openssl路径

OpenSSL 1.0.2k-fips  26 Jan 2017
built on: reproducible build, date unspecified
platform: linux-x86_64
options:  bn(64,64) md2(int) rc4(16x,int) des(idx,cisc,16,int) idea(int) blowfish(idx) 
compiler: gcc -I. -I.. -I../include  -fPIC -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DKRB5_MIT -m64 -DL_ENDIAN -Wall -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic -Wa,--noexecstack -DPURIFY -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM
OPENSSLDIR: "/etc/pki/tls"
engines:  rdrand dynamic 

#which openssl
/usr/bin/openssl

三、安装nginx

 
cd /usr/local/
[root@localhost local]#tar -zxvf nginx-1.16.1.tar.gz
[root@localhost local]#cd nginx-1.16.1
 
#配置--- 
[root@localhost nginx-1.16.1]#./configure --prefix=/usr/local/nginx-1.16.1-use --with-pcre=/usr/local/pcre-8.36 --with-zlib=/usr/local/zlib-1.2.8 --with-http_stub_status_module --with-openssl=/usr/bin/openssl

#编译并安装nginx
[root@localhost nginx-1.16.1]#make && make install 
#将nginx命令拷贝到用户执行路径,便于随时使用nginx命令
[root@localhost nginx-1.16.1]#cp -ri /usr/local/nginx-1.16.1-use/sbin/nginx /usr/bin/

#检查nginx是否有问题
[root@localhost local]#nginx -t
nginx: the configuration file /usr/local/nginx-1.16.1-use/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx-1.16.1-use/conf/nginx.conf test is successful

#启动nginx

[root@localhost local]#nginx -c /usr/local/nginx-1.16.1-use/conf/nginx.conf

 

Welcome to nginx!

If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.

Thank you for using nginx.

 

安装依赖包资源已上传,请自行下载。

离线安装依赖包下载

你可能感兴趣的:(linux相关,服务,应用性能)