首先先把这个文件上传到root目录下,并解压
#tar zxf nginx-1.11.2.tar.gz
写脚本
# vi nginx-running.sh
安装编译环境(可省略,一般都自带编译环境)
# yum -y groupinstall "Development Tools" "Server Platform Development"
rpm安装两个rpm包
# rpm -ivh /opt/dvd/Packages/zlib-devel-1.2.7-13.el7.x86_64.rpm
# rpm -ivh /opt/dvd/Packages/pcre-devel-8.32-12.el7.x86_64.rpm
添加一个nginx用户
# useradd -s /sbin/nologin -M nginx
# id ngin
#cd nginx-1.11.2
# ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx
#make
#make install
# cd /usr/local/nginx/sbin/
# /usr/local/nginx/sbin/nginx
# ps aux | grep nginx
添加80端口
# ss -tanml | grep 80
# cp nginx-running.sh nginx
# cp nginx /etc/init.d/
# cd /etc/init.d/
# chkconfig --add nginx
# chkconfig --list nginx
如果是关着的则用
#chkconfig nginx on
关闭防火墙打开网页