安装依赖

1
2
3
4
yum -y install gcc-c++
yum -y install pcre pcre-devel
yum -y install zlib zlib-devel
yum -y install openssl openssl-devel libssl-dev

下载源码

1
2
wget http://nginx.org/download/nginx-1.9.12.tar.gz
tar -zxvf nginx-1.9.12.tar.gz

编译安装

1
2
3
./configure --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_ssl_module
make
make install

查看

1
whereis nginx

防火墙放开

1
2
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload

启动

1
/usr/local/nginx/nginx

关闭

1
/usr/local/nginx/nginx -s stop

参考