如何安装nginx


centos7安装nginx

添加nginx的yum仓库

sudo vim /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
module_hotfixes=true

[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
module_hotfixes=true

安装步骤


# 查看可用版本(enable)
yum repolist all| grep nginx

# 默认时最新稳定版,要安装开发版的话,需要执行此行
#sudo yum-config-manager --enable nginx-mainline

# 安装
sudo yum install nginx

# 启动nginx并设置开机自启
systemctl start nginx
systemctl enable nginx

# 确认安装成功
curl http://127.0.01

文章作者: lcok
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 lcok !
打赏
  目录