- 安装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.运行nginx
nginx
5.查看nginx相关文件位置
whereis nginx
结果显示如下
nginx: /usr/sbin/nginx /usr/lib64/nginx /etc/nginx /usr/share/nginx /usr/share/man/man8/nginx.8.gz
配置文件保存在/etc/nginx
默认根目录/usr/share/nginx/html
网友评论