1.先安装相关依赖以及库:
yum install -y gcc-c++
yum install -y pcre pcre-devel
yum install -y zlib zlib-devel
yum install -y openssl openssl-devel
2.下载nginx安装包:
wget -c https://nginx.org/download/nginx-1.12.0.tar.gz
然后直接解压
tar -zxvf nginx-1.12.0.tar.gz
3.进入该目录,并编译
cd nginx-1.12.0
./configure
make
make install
4.然后可以cd进入/usr/local/nginx/sbin/下
./nginx:开启nginx服务
./nginx -s reload:重启nginxfuwu
./nginx -s stop:关闭nginx服务
5.最后测试(在浏览器输入,自己系统的ip地址即可访问到一个 welcome to nginx!的页面)