一、编译安装
./configure
--prefix=/usr/local/nginx ====>定义安装目录
--with-http_ssl_module =====>https模块
--with-http_flv_module ====>流媒体模块
--with-http_stub_status_module ====>该模块用来支持 nginx运行状态查询
--with-http_gzip_static_module ====>压缩模块
--with-pcre=../pcre-8.39 =====>支持正则模块所在路径
--with-zlib=../zlib-1.2.8 =====>支持压缩模块所在路径
--with-openssl=../openssl-master =====>支持https模块所在路径
# 检查配置文件是否正确
# /usr/local/sbin/nginx -t
# 可以看到编译选项
# /usr/local/sbin/nginx -V
#重启Nginx =====>重新加载配置文件
#sudo /usr/local/sbin/nginx -s reload
#关闭Nginx
#sudo /usr/local/sbin/nginx -s stop
#优雅停止服务 =====>就是等待所有数据传输完再关闭,即安全的关闭
#sudo /usr/local/sbin/nginx -s quit
#kill -s SIGQUIT pid_master
#kill -s SIGWINCH pid_master
二、yum安装
vi /etc/yum.repos.d/nginx.repo(写入下面内容)
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
yum install nginx