nginx 由于错误“HTTP 错误 503:服务不可用”而无法安装

问题描述 投票:0回答:1

背景

我想在OpenStack的CentOS 7上安装nginx,但安装失败。所以我想听听建议或意见。

环境

  1. 终端环境
  • Windows10 64位
  • Rlogin - 终端软件
  1. OpenStack 上的 CentOS
  • 操作是使用具有 sudo 权限的帐户完成的(sudo avaialble)
  • CentOS 7
  • OpenSSL v3.2.1、Python v3.10 从源代码安装。

我做了什么

基本上我跟着的是URI:NGINX安装指南

  1. 安装先决条件:
    sudo yum install yum-utils
    。安装成功。
  2. 创建了名为 /etc/yum.repos.d/nginx.repo 的 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
skip_if_unavailable=1
keepcache=0

[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
skip_if_unavailable=1
keepcache=0
  1. 已确认可用
    yum info nginx
    已执行,返回以下输出。
loaded plugin: langpacks
nginx-mainline
nginx-stable
nginx-mainline/7/x86_64/primary_db

Available package:
Name          : nginx
Architecture  : x86_64
Epoch         : 1
Version       : 1.25.4
Release       : 1.el7.ngx
Volume        : 802 k
Repository    : nginx-mainline/7/x86_64
Abstract      : High performance web server
URL           : https://nginx.org/
License       : 2-clause BSD-like license
Explanation   : nginx [engine x] is an HTTP and reverse proxy server,
                as well as a mail proxy server 
  1. 执行以下命令:
    sudo yum-config-manager --enable nginx-mainline
  2. 最后执行以下命令安装nginx:
    sudo yum install nginx

错误输出

执行上一节中描述的第 4 条命令时,返回以下错误消息。

loaded plugins: langpacks
crepo                                    | 3.6 kB 00:00:00
crepo-extras                             | 3.4 kB 00:00:00
crepo-updates                            | 3.4 kB 00:00:00

http://nginx.org/packages/mainline/centos/7/x86_64/repodata/repomd.xml: [Error 14] HTTP 503 - Service Unavailable
Package: nginx is unavailable
Error: Nothing is done.

One of the configured repositories failed (nginx mainline repo), 
and yum doesn't have enough cached data to continue. 
At this point the only safe thing yum can do is fail. 
There are a few ways to work "fix" this:

1.  Contact the upstream for the repository and get them to fix the problem.
2.  Reconfigure the baseurl/etc. for the repository, to point to a working upstream.
    This is most often useful if you are using a newer distribution release 
    than is supported by the repository ( and the packages for the previous distribution
    release still not work).
3.  Run the command with the repository temporarily disabled 
        yum --disablerepo=nginx-mainline ...
4.  Disable the repository permanently, so yum won't use it by default. 
    Yum will then just ignore the repository until you permanently enable it again or 
    use --enablerepo for temporary usage.
        yum-config-manager --disable nginx-mainline
     or
        subscription-manager repos --disable=nginx-mainline
5.  Configure the failing repository to be skipped, if it is unavailable.
    Note that yum will try to contact the repo. When it runs most commands,
    so will have to try and fail each time (and thus, yum will be much slower)
    If it is a very temporary problem though, this is often a nice compromise.
        yum-config-manager --save --setopt=nginx-mainline.skip_if_unavailable=true

从上面的错误消息来看,无法访问“http://nginx.org/packages/centos/7/x86_64”是由于 HTTP 503 错误。 HTTP 503 错误意味着服务器有一些问题,但是,我可以在现代浏览器上轻松访问“http://nginx.org/packages/centos/7/x86_64”。所以我很困惑这是什么原因。

如果您能解释这个问题或提供一些建议,请帮助我。

nginx centos7 yum
1个回答
0
投票

这意味着不再支持CentOS 7。您可以尝试切换到 Vault 存储库,但我强烈建议升级到更新的操作系统版本 - 或从源构建 nginX。

cd /etc/yum.repos.d/
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
dnf update
© www.soinside.com 2019 - 2024. All rights reserved.