簡(jiǎn)介
在Centos7.6 中通過yum方式安裝Nginx
添加nginx yum源
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
安裝nginx
yum install -y nginx
若提示沒有可用的軟件包則執(zhí)行如下三行
yum install epel-release
yum update
yum install -y nginx
啟動(dòng)nginx
systemctl start nginx.service
開機(jī)啟動(dòng)Nginx
systemctl enable nginx.service
防火墻開放80 和443 端口
firewall-cmd --permanent --zone=public --add-port=80/tcp
firewall-cmd --permanent --zone=public --add-port=443/tcp
#重啟防火墻
firewall-cmd --reload
Nginx配置信息
#yum方式安裝后默認(rèn)配置文件的路徑
/etc/nginx/nginx.conf
#nginx網(wǎng)站默認(rèn)存放目錄
/usr/share/nginx/html
#網(wǎng)站默認(rèn)主頁路徑
/usr/share/nginx/html/index.html
#啟動(dòng)nginx
service nginx start
#停止nginx
service nginx stop
#重載nginx
service nginx reload