1、安装依赖
yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
2、下载安装包,解压
wget http://nginx.org/download/nginx-1.12.2.tar.gz
tar -zxvf nginx-1.12.2.tar.gz
3、检测nginx目标的安装特征,需要添加ssl模块
cd nginx-1.12.2/
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
4、编译安装
make && make install
5、启动
cd /usr/local/nginx/sbin
./nginx
6、常用命令
./nginx -t
./nginx -s reload
./nginx -s stop
./nginx -s quit