要添加CentOS EPEL仓库,终端使用yum命令安装,直接复制执行:nginx
sudo yum -y install epel-release
如今Nginx存储库已经安装在您的服务器上,使用如下yum
命令安装Nginx :浏览器
sudo yum -y install nginx
Nginx不会自动启动.要运行Nginx,请输入:服务器
sudo systemctl start nginx
若是您正在运行防火墙,请运行如下命令以容许HTTP和HTTPS通讯:(若是防火墙关了,可直接跳过)测试
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload
浏览器里键入你的主机地址spa
若是看到这个页面,那么你的Web服务器如今已经正确安装了。code
若是想在系统启动时启用Nginx。请输入如下命令:blog
sudo systemctl enable nginx
恭喜你!!! Nginx如今已经成功安装并容许了!!教程
service nginx stop
chkconfig nginx off
rm -rf /usr/sbin/nginx rm -rf /etc/nginx rm -rf /etc/init.d/nginx
yum remove nginx
ok结束。rem
原创内容,转载请注明出处,以为不错点个赞哦!!!!!cmd