环境centos7
1)安装依赖
yum -y install gcc gcc-c++ yum -y install zlib zlib-devel openssl openssl-devel pcre-devel
2)解压
tar xf nginx-1.14.2.tar.gz cd nginx-1.14.2/
3)添加nginx组,用户
groupadd www useradd www -g www -s /sbin/nologin -M
4)对ngnix进行配置安装
./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module && make && make install
5)查看版本号
/usr/local/nginx/sbin/nginx -v
6)启动ngnix
/usr/local/nginx/sbin/nginx
/usr/local/nginx/sbin/nginx -s reload 重新载入配置文件
/usr/local/nginx/sbin/nginx -s stop 快速关闭 Nginx
/usr/local/nginx/sbin/nginx -s quit 关闭Nginx