要添加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