centos 安装nginx

一、配置epel yum 源
# wget http://dl.Fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm 
# rpm -ivh epel-release-latest-7.noarch.rpm
# yum install nginx -y
#  yum remove nginx  卸载

二、查看确认 是否安装

 # rpm -qa | grep nginx
image.png

三、查看 安装nginx 所生成的文件

# rpm -ql nginx 

四、启动nginx

//启动nginx
# systemctl start nginx 
//设置开机启动
# systemctl enable nginx
//查看nginx 启动状态
# systemctl status nginx
# 无法关闭 netstat -nltp
# kill ` ps -ef | grep 'nginx' | awk '{print $2}' `

在浏览器中输入 nginx 服务器的ip 地址,如果不能正常访问,关闭防火墙

 // 停止firewall
# systemctl stop firewalld.service 
// 禁止firewall开机启动
# systemctl disable firewalld.service 
// 查看默认防火墙状态(关闭后显示notrunning,开启后显示running)
# firewall-cmd --state 

setenforce 0

你可能感兴趣的:(centos 安装nginx)