使用yum安装nginx

ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
http://nginx.org/en/download.html
http://zlib.net/fossils/
https://www.openssl.org/source/old/

一键安装需要的所有依赖

yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel

安装nginx

直接用yum -y install nginx也可以,但是默认的安装目录和平时使用的不太一样,因此采用手动安装的形式。

解压nginx安装包,从上面的地址官网下载
[root@hadoop soft]# tar -zxvf nginx-1.15.6.tar.gz 
进入到解压的目录
[root@hadoop soft]# cd nginx-1.15.6
编译一下,configure后面有很多参数,可以使用./configure --help 来查看,如果需要使用SSL和正则表达式,需要指定openssl 和pcre的安装目录,要不然可能默认路径不一定是依赖包的安装目录,zlib是压缩的依赖包。
执行编译命令
[root@hadoop nginx-1.15.6]# ./configure 
执行make和安装命令
[root@hadoop nginx-1.15.6]# make && make install
安装完之后看下这个目录是不是有东西。
/usr/local/nginx
进入到这个目录执
cd  /usr/local/nginx/sbin
启动nginx命令
[root@hadoop sbin]# ./nginx -c /usr/local/nginx/conf/nginx.conf
检测nginx配置文件是否正常
[root@hadoop sbin]# ./nginx -t -c /usr/local/nginx/conf/nginx.conf
nginx平滑启动
[root@hadoop sbin]# ./nginx -s reload
查看openssl 的安装目录
[root@hadoop nginx]# whereis openssl 

猜你喜欢

转载自blog.csdn.net/u010316188/article/details/84306845