日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學(xué)無先后,達(dá)者為師

網(wǎng)站首頁 編程語言 正文

centos8安裝nginx時報錯Status:404

作者:Pisces_224 更新時間: 2022-02-27 編程語言

centOS 8 安裝nginx報錯:

[root@xxx]# yum install nginx
CentOS Linux 8 - AppStream                                                                            6.3 kB/s | 2.3 kB     00:00    
Errors during downloading metadata for repository 'appstream':
  - Status code: 404 for http://mirrors.cloud.aliyuncs.com/centos/8/AppStream/x86_64/os/repodata/repomd.xml (IP: 100.100.2.148)
Error: Failed to download metadata for repo 'appstream': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

解決

1. 備份原有配置

cp /etc/yum.repos.d/CentOS-Linux-BaseOS.repo /etc/yum.repos.d/CentOS-Linux-BaseOS.repo1

cp /etc/yum.repos.d/CentOS-Linux-AppStream.repo /etc/yum.repos.d/CentOS-Linux-AppStream.repo1

2. 編輯配置文件

① 編輯CentOS-Linux-BaseOS.repo

vim /etc/yum.repos.d/CentOS-Linux-BaseOS.repo

此時進(jìn)入了正常模式,然后按冒號鍵進(jìn)入命令模式,執(zhí)行以下命令:

%s/mirrors.cloud.aliyuncs.com/mirrors.aliyun.com/g
%s/$releasever/$releasever-stream/g

保存退出:

:wq!

② 編輯CentOS-Linux-AppStream.repo

vim /etc/yum.repos.d/CentOS-Linux-AppStream.repo

此時進(jìn)入了正常模式,然后按冒號鍵進(jìn)入命令模式,執(zhí)行以下命令:

%s/mirrors.cloud.aliyuncs.com/mirrors.aliyun.com/g
%s/$releasever/$releasever-stream/g

保存退出:

:wq!

3. 構(gòu)建緩存,更新yum源

yum makecache
yum update

4. 繼續(xù)安裝nginx:

sudo yum install nginx
Is this OK[Y/N]:   y

在這里插入圖片描述

啟動nginx服務(wù)

$ sudo systemctl enable nginx
$ sudo systemctl start nginx

檢驗nginx是否在運(yùn)行:

$ sudo systemctl status nginx

默認(rèn)80端口,瀏覽器打開訪問:

在這里插入圖片描述

原文鏈接:https://blog.csdn.net/qq_36256590/article/details/122937744

欄目分類
最近更新