网站首页 程序开发 CentOS7 nginx安装与卸载
要添加CentOS EPEL仓库,终端使用yum命令安装,直接复制执行:
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
浏览器里键入你的主机地址
如果看到这个页面,那么你的Web服务器现在已经正确安装了。
如果想在系统启动时启用Nginx。请输入以下命令:
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结束。