1、安装依赖
yum install -y gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel
解释:gcc 编译环境;PCRE pcre-devel perl库;zlib压缩解压;支持ssl
2、下载nginx的压缩包
wget -c https://nginx.org/download/nginx-1.12.0.tar.gz
3、解压nginx压缩包
tar -zxvf nginx-1.12.0.tar.gz
cd nginx-1.12.0
4、使用默认配置
./configure
5、编译
make
make install
6、参照安装路径
whereis nginx
7、启动、停止nginx
cd /usr/local/nginx/sbin/
./nginx
./nginx -s stop
./nginx -s quit
./nginx -s reload
9、启动nginx时端口被占用./nginx
解决方案:安装net-tool包查看
yum install net-tools
lsof -i :80