-------------------环境准备--------------------

[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo ##安装阿里云yum源 

[root@localhost ~]# yum -y install epel-release ##安装epel源

[root@localhost ~]# yum install -y gcc pcre pcre-devel zlib zlib-devel openssl openssl-devel ##安装依赖安装包

-----------新建nginx用户>下载程序>解压>编译安装。----------------

[root@localhost ~]# useradd -s /sbin/nologin -M nginx ##创建nginx用户  

[root@localhost ~]# wget http://nginx.org/download/nginx-1.13.12.tar.gz ##下载nginx安装包

[root@localhost ~]# tar -xzvf nginx-1.13.12.tar.gz ##解压

[root@localhost ~]# cd nginx-1.13.12/

[root@localhost ~]# ./configure --prefix=/usr/local/nginx \ --user=nginx \ --group=nginx \ --with-http_ssl_module \ --with-http_stub_status_module  ##编译安装

[root@localhost ~]# make && make install

------------程序关闭启动方式----------------

[root@localhost ~]# /usr/local/nginx/sbin/nginx -t #检测配置文件正确性
[root@localhost ~]# /usr/local/nginx/sbin/nginx #启动Nginx
[root@localhost ~]# kill -QUIT $(cat /usr/local/nginx/logs/nginx.pid) #关闭Nginx
[root@localhost ~]# kill -HUP $(cat /usr/local/nginx/logs/nginx.pid) #重启Nginx