首页 > 后端 > 正文

移除舊有已安裝 NGINX

查看現有安裝 NGINX 版本:

nginx -v
nginx version: nginx/1.14.1




移除已安裝的 NGINX:

請先自行備份 /etc/nginx 目錄下的所有檔案

yum remove nginx -y

移除 NGINX 設定檔:

rm -rf /etc/nginx/

安裝 NGINX 穩定或最新版本

安裝能夠選擇指定 yum 的套件:

yum install yum-utils -y

新增 NGINX 官方軟體倉庫 (repository):

vim /etc/yum.repos.d/nginx.repo
# 穩定版
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
module_hotfixes=true

# 最新版
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=0
enabled=0
module_hotfixes=true

切換使用 nginx-stable 穩定版:

如欲安裝 NGINX 最新版,請替換 nginx-stable => nginx-mainline

yum-config-manager --enable nginx-stable

查看欲安裝的 NGINX 版本資訊:

 yum info nginx
上次中介資料過期檢查:0:07:49 以前,時間點為西元2020年04月05日 (週日) 11時17分11秒。
可用的軟體包
Name         : nginx
Epoch        : 1
Version      : 1.16.1
發行版       : 1.el8.ngx
Architecture : x86_64
Size         : 797 k
來源         : nginx-1.16.1-1.el8.ngx.src.rpm
Repository   : nginx-stable
Summary      : High performance web server
URL          : http://nginx.org/
授權         : 2-clause BSD-like license
Description  : nginx [engine x] is an HTTP and reverse proxy server, as well as
             : a mail proxy server.

安裝 NGINX:

yum install nginx -y

查看安裝的 NGINX 版本:

nginx -v
nginx version: nginx/1.16.1

猜你喜欢
发表评论

电子邮件地址不会被公开。 必填项已用*标注

评论信息
picture loss