Myluzh Blog

CentOS安装nginx

发布时间: 2023-6-1 文章作者: myluzh 分类名称: Nginx 朗读文章


0x01 通过rpm包离线安装
rpm包地址:https://nginx.org/packages/centos/7/x86_64/RPMS/
wget https://nginx.org/packages/centos/7/x86_64/RPMS/nginx-1.24.0-1.el7.ngx.x86_64.rpm
rpm -i nginx-1.24.0-1.el7.ngx.x86_64.rpm

0x02 创建nginx仓库文件
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
#安装nginx稳定版
yum install nginx -y
#安装nginx主线版本
yum-config-manager --enable nginx-mainline

0x03 其他

配置文件位于:/etc/nginx
二进制文件位于:/usr/sbin/nginx
删除nginx
yum remove nginx
rm -rf /etc/nginx/
rm -rf /etc/yum.repos.d/nginx.repo

标签: centos nginx

发表评论