nginx can not be installed due to the error 'HTTP Error 503: Service Unavailable '

41 views Asked by At

Background

I want to install nginx on CentOS 7 on the OpenStack but the installation fails. So I want to hear an advise or comments.

Environment

  1. Terminal environemnt
  • Windows10 64bit
  • Rlogin - terminal software
  1. CentOS on OpenStack
  • operation is done with an account with sudo priviledge (sudo avaialble)
  • CentOS 7
  • OpenSSL v3.2.1, Python v3.10 are installed from source.

What I did

Basically I was followed by the URI : NGINX installation guide

  1. Install prerequisites : sudo yum install yum-utils. Installation was success.
  2. repo file named /etc/yum.repos.d/nginx.repo was created and following content was described.
[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. Confirmed the avialability yum info nginx was executed, following output was returned.
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. Next following command was executed: sudo yum-config-manager --enable nginx-mainline
  2. Finally, following commad was executed to install nginx : sudo yum install nginx.

Error output

When command described No. 4 in previous section was executed, following error message was returned.

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

From error messages above, inaccessibility to 'http://nginx.org/packages/centos/7/x86_64' is due to an HTTP 503 Error. The HTTP 503 Error means that the server has some issues, however, I can easily access to the 'http://nginx.org/packages/centos/7/x86_64' on the modern browser. So I am very confused what is the reason.

Please help me if you can explain this issue or some advise.

1

There are 1 answers

2
IVO GELOV On

It means that CentOS 7 is no longer supported. You can try switching to Vault repositories but I strongly suggest upgrading to a more recent OS version - or build nginX from sources.

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