rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum install -y nginx
#启动,重启,开机自启nginx systemctl start nginx systemctl restart nginx systemctl enable nginx
#查看当前所有tcp端口 netstat -ntlp
#若发现服务启动不了,说明80端口被其他占用,nginx端口默认为80端口 #查找nginx.conf文件,80端口已被占用,修改默认端口 find / -name "nginx.conf" vi /**实际路径/nginx.conf #修改端口后,重新启动 systemctl restart nginx
#如端口被httpd,占用,也可以修改httpd配置端口
find / -name httpd.conf
vi /etc/httpd/conf/httpd.conf netstat -ntlp systemctl restart httpd