- 安裝yum-utils
sudo yum -y install yum-utils
2.新建文件/etc/yum.repos.d/nginx.repo
cat <<ENDOF >/etc/yum.repos.d/nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/\$releasever/\$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/\$releasever/\$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
ENDOF
3.yum 安裝nginx
sudo yum -y install nginx
4.運(yùn)行nginx
nginx
5.查看nginx相關(guān)文件位置
whereis nginx
結(jié)果顯示如下
nginx: /usr/sbin/nginx /usr/lib64/nginx /etc/nginx /usr/share/nginx /usr/share/man/man8/nginx.8.gz
配置文件保存在/etc/nginx
默認(rèn)根目錄/usr/share/nginx/html