centos8中如何使用yum安裝nginx

centos8中怎樣使用yum安裝 nginx

centos8 安裝 nginx

yum 直接安裝

centos8和centos7安裝nginx有點點不一樣,centos8 自帶了nginx 1.14.1 ,我們先升級到新穩定版1.20.1

在etc目錄下創建repo源文件

cd?/etc/yum.repos.d? ??touch?nginx.repo

使用vim編輯

??vim?nginx.repo

2.復制以下內容,并使用:wq保存

[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

3.查看源是否修改成功

??yum?info?nginx

4.安裝nginx

??yum?install?nginx?-y

nginx基本命令

使用systemctl全局進程管理,不用去sbin啟動

#?開啟? systemctl?start?nginx  #停止 systemctl?stop?nginx  #重載nginx systemctl?reload?nginx

不使用 systemctl ,可以nginx的sbin啟動,yum安裝 在/usr/sbin

#切換到?/usr/sbin cd?/usr/sbin #?開啟? ?./nginx??  #停止 ./nginx?-s?stop  #重載nginx ./nginx?-s?reload

查看nginx 進程狀態

ps?-ef?|grep?nginx

? 版權聲明
THE END
喜歡就支持一下吧
點贊13 分享