打開nginx的官網(wǎng)
http://nginx.org/
進入下載界面
http://nginx.org/en/download.html
QQ圖片20190423115112.png
進入下面紅框的鏈接
http://nginx.org/en/linux_packages.html
找到 RHEL/CentOS
image.png
按照說明進行安裝
安裝結(jié)束后房揭,需要開啟服務
查看自啟服務狀態(tài)
systemctl list-unit-files | grep nginx
查看狀態(tài)
systemctl status nginx.service
啟動服務
systemctl start nginx
開啟自啟
systemctl enable nginx.service
此時服務器已經(jīng)可以訪問了
如果是主機來訪問虛擬機中nginx的服務李丰,需要防火墻開啟http和https
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
防火墻重載配置
firewall-cmd --reload
這樣主機就可以訪問虛擬中的nginx服務器了