title: Install nginx / apache on CentOS 8 - Unable to find a match nginx / httpd
body: <p>I googled it and tried lots of solutions, but this problem still happened.</p>
  
  <p>This is my yum.conf:</p>
  
  <pre><code>[root@localhost etc]# cat yum.conf 
  [main]
  gpgcheck=1
  installonly_limit=3
  clean_requirements_on_remove=True
  best=True
  </code></pre>
  
  <p>I tried to re-install epel-release:</p>
  
  <pre><code>[root@localhost ~]# dnf update
  Last metadata expiration check: 0:01:38 ago on Sat 09 May 2020 01:30:20 AM EDT.
  Dependencies resolved.
  Nothing to do.
  Complete!
  [root@localhost ~]# dnf install httpd
  Last metadata expiration check: 0:01:45 ago on Sat 09 May 2020 01:30:20 AM EDT.
  No match for argument: httpd
  Error: Unable to find a match: httpd
  [root@localhost ~]# dnf provides httpd
  Last metadata expiration check: 0:01:56 ago on Sat 09 May 2020 01:30:20 AM EDT.
  Error: No Matches found
  [root@localhost ~]# dnf install epel-release
  Last metadata expiration check: 0:02:31 ago on Sat 09 May 2020 01:30:20 AM EDT.
  Package epel-release-8-8.el8.noarch is already installed.
  Dependencies resolved.
  Nothing to do.
  Complete!
  </code></pre>
  
  <p>Re-enabled modules:</p>
  
  <pre><code>[root@localhost ~]# dnf search httpd
  Last metadata expiration check: 0:02:45 ago on Sat 09 May 2020 01:30:20 AM EDT.
  ====================================================================== Name &amp; Summary Matched: httpd =======================================================================
  libmicrohttpd-doc.noarch : Documentation for libmicrohttpd
  libmicrohttpd-devel.i686 : Development files for libmicrohttpd
  libmicrohttpd-devel.x86_64 : Development files for libmicrohttpd
  lighttpd-filesystem.noarch : The basic directory layout for lighttpd
  centos-logos-httpd.noarch : CentOS-related icons and pictures used by httpd
  lighttpd-mod_authn_pam.x86_64 : Authentication module for lighttpd that uses PAM
  lighttpd-mod_authn_gssapi.x86_64 : Authentication module for lighttpd that uses GSSAPI
  keycloak-httpd-client-install.noarch : Tools to configure Apache HTTPD as Keycloak client
  lighttpd-mod_mysql_vhost.x86_64 : Virtual host module for lighttpd that uses a MySQL database
  lighttpd-fastcgi.x86_64 : FastCGI module and spawning helper for lighttpd and PHP configuration
  lighttpd-mod_authn_mysql.x86_64 : Authentication module for lighttpd that uses a MySQL database
  python3-keycloak-httpd-client-install.noarch : Tools to configure Apache HTTPD as Keycloak client
  =========================================================================== Name Matched: httpd ============================================================================
  lighttpd.x86_64 : Lightning fast webserver with light system requirements
  httpd-devel.x86_64 : Development interfaces for the Apache HTTP server
  httpd-tools.x86_64 : Tools for use with the Apache HTTP Server
  httpd-manual.noarch : Documentation for the Apache HTTP server
  libmicrohttpd.i686 : Lightweight library for embedding a webserver in applications
  libmicrohttpd.x86_64 : Lightweight library for embedding a webserver in applications
  sysusage-httpd.noarch : Apache configuration for sysusage
  httpd-filesystem.noarch : The basic directory layout for the Apache HTTP server
  httpd-filesystem.noarch : The basic directory layout for the Apache HTTP server
  ========================================================================== Summary Matched: httpd ==========================================================================
  mod_dav_svn.x86_64 : Apache httpd module for Subversion server
  mod_auth_mellon.x86_64 : A SAML 2.0 authentication module for the Apache Httpd Server
  [root@localhost ~]# dnf module list --enabled
  Last metadata expiration check: 0:03:42 ago on Sat 09 May 2020 01:30:20 AM EDT.
  CentOS-8 - AppStream
  Name                                 Stream                        Profiles                                        Summary                                                  
  go-toolset                           rhel8 [d][e]                  common [d]                                      Go                                                       
  httpd                                2.4 [d][e]                    common [d], devel, minimal                      Apache HTTP Server                                       
  mariadb                              10.3 [d][e]                   client, server [d], galera                      MariaDB Module                                           
  mysql                                8.0 [d][e]                    client, server [d]                              MySQL Module                                             
  perl-DBD-MySQL                       4.046 [d][e]                  common [d]                                      A MySQL interface for Perl                               
  perl-DBI                             1.641 [d][e]                  common [d]                                      A database access API for Perl                           
  python27                             2.7 [d][e]                    common [d]                                      Python programming language, version 2.7                 
  python36                             3.6 [d][e]                    common [d], build                               Python programming language, version 3.6                 
  satellite-5-client                   1.0 [d][e]                    common [d], gui                                 Red Hat Satellite 5 client packages                      
  
  Remi's Modular repository for Enterprise Linux 8 - x86_64
  Name                                 Stream                        Profiles                                        Summary                                                  
  php                                  remi-7.4 [e]                  common [d] [i], devel, minimal                  PHP scripting language                                   
  
  Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
  [root@localhost ~]# dnf module disable httpd
  Last metadata expiration check: 0:04:00 ago on Sat 09 May 2020 01:30:20 AM EDT.
  Dependencies resolved.
  ============================================================================================================================================================================
   Package                                  Architecture                            Version                                    Repository                                Size
  ============================================================================================================================================================================
  Disabling modules:
   httpd                                                                                                                                                                     
  
  Transaction Summary
  ============================================================================================================================================================================
  
  Is this ok [y/N]: y
  Complete!
  [root@localhost ~]# dnf module enable httpd:2.4/common
  Last metadata expiration check: 0:04:19 ago on Sat 09 May 2020 01:30:20 AM EDT.
  Ignoring unnecessary profile: 'httpd/common'
  Dependencies resolved.
  ============================================================================================================================================================================
   Package                                  Architecture                            Version                                    Repository                                Size
  ============================================================================================================================================================================
  Enabling module streams:
   httpd                                                                            2.4                                                                                      
  
  Transaction Summary
  ============================================================================================================================================================================
  
  Is this ok [y/N]: y
  Complete!
  [root@localhost ~]# dnf module list
  CentOS-8 - AppStream                                                                                                                        3.6 kB/s | 4.3 kB     00:01    
  CentOS-8 - Base                                                                                                                             6.0 kB/s | 3.9 kB     00:00    
  CentOS-8 - Extras                                                                                                                           441  B/s | 1.5 kB     00:03    
  CentOS-8 - PowerTools                                                                                                                       1.9 kB/s | 4.3 kB     00:02    
  Extra Packages for Enterprise Linux Modular 8 - x86_64                                                                                      9.5 kB/s | 9.4 kB     00:00    
  Extra Packages for Enterprise Linux 8 - x86_64                                                                                              6.1 kB/s | 9.0 kB     00:01    
  Node.js Packages for Enterprise Linux 8 - x86_64                                                                                            9.6 kB/s | 2.5 kB     00:00    
  Remi's Modular repository for Enterprise Linux 8 - x86_64                                                                                   417  B/s | 3.5 kB     00:08    
  Safe Remi's RPM repository for Enterprise Linux 8 - x86_64                                                                                  2.5 kB/s | 3.0 kB     00:01    
  CentOS-8 - AppStream
  Name                      Stream               Profiles                                     Summary                                                                         
  389-ds                    1.4                                                               389 Directory Server (base)                                                     
  ant                       1.10 [d]             common [d]                                   Java build tool                                                                 
  container-tools           rhel8 [d]            common [d]                                   Common tools and dependencies for container runtimes                            
  container-tools           1.0                  common [d]                                   Common tools and dependencies for container runtimes                            
  freeradius                3.0 [d]              server [d]                                   High-performance and highly configurable free RADIUS server                     
  gimp                      2.8 [d]              common [d], devel                            gimp module                                                                     
  go-toolset                rhel8 [d][e]         common [d]                                   Go                                                                              
  httpd                     2.4 [d][e]           common [d], devel, minimal                   Apache HTTP Server                                                              
  idm                       DL1                  common [d], adtrust, client, dns, server     The Red Hat Enterprise Linux Identity Management system module                  
  idm                       client [d]           common [d]                                   RHEL IdM long term support client module                                        
  inkscape                  0.92.3 [d]           common [d]                                   Vector-based drawing program using SVG                                          
  javapackages-runtime      201801 [d]           common [d]                                   Basic runtime utilities to support Java applications                            
  jmc                       rhel8                common, core                                 Java Mission Control is a profiling and diagnostics tool for the Hotspot JVM    
  libselinux-python         2.8                  common                                       Python 2 bindings for libselinux                                                
  llvm-toolset              rhel8 [d]            common [d]                                   LLVM                                                                            
  mailman                   2.1 [d]              common [d]                                   Electronic mail discussion and e-newsletter lists managing software             
  mariadb                   10.3 [d][e]          client, server [d], galera                   MariaDB Module                                                                  
  maven                     3.5 [d]              common [d]                                   Java project management and project comprehension tool                          
  mercurial                 4.8 [d]              common [d]                                   Mercurial -- a distributed SCM                                                  
  mod_auth_openidc          2.3                                                               Apache module suporting OpenID Connect authentication                           
  mysql                     8.0 [d][e]           client, server [d]                           MySQL Module                                                                    
  nginx                     1.14 [d]             common [d]                                   nginx webserver                                                                 
  nginx                     1.16                 common                                       nginx webserver                                                                 
  nodejs                    10 [d][x]            common [d], development, minimal, s2i        Javascript runtime                                                              
  nodejs                    12 [x]               common, development, minimal, s2i            Javascript runtime                                                              
  parfait                   0.5                  common                                       Parfait Module                                                                  
  perl                      5.24                 common [d], minimal                          Practical Extraction and Report Language                                        
  perl                      5.26 [d]             common [d], minimal                          Practical Extraction and Report Language                                        
  perl-App-cpanminus        1.7044 [d]           common [d]                                   Get, unpack, build and install CPAN modules                                     
  perl-DBD-MySQL            4.046 [d][e]         common [d]                                   A MySQL interface for Perl                                                      
  perl-DBD-Pg               3.7 [d]              common [d]                                   A PostgreSQL interface for Perl                                                 
  perl-DBD-SQLite           1.58 [d]             common [d]                                   SQLite DBI driver                                                               
  perl-DBI                  1.641 [d][e]         common [d]                                   A database access API for Perl                                                  
  perl-FCGI                 0.78 [d]             common [d]                                   FastCGI Perl bindings                                                           
  perl-YAML                 1.24 [d]             common [d]                                   Perl parser for YAML                                                            
  php                       7.2 [d]              common [d], devel, minimal                   PHP scripting language                                                          
  php                       7.3                  common, devel, minimal                       PHP scripting language                                                          
  pki-core                  10.6                                                              PKI Core module for PKI 10.6 or later                                           
  pki-deps                  10.6                                                              PKI Dependencies module for PKI 10.6 or later                                   
  postgresql                9.6                  client, server [d]                           PostgreSQL server and client module                                             
  postgresql                10 [d]               client, server [d]                           PostgreSQL server and client module                                             
  postgresql                12                   client, server                               PostgreSQL server and client module                                             
  python27                  2.7 [d][e]           common [d]                                   Python programming language, version 2.7                                        
  python36                  3.6 [d][e]           common [d], build                            Python programming language, version 3.6                                        
  redis                     5 [d]                common [d]                                   Redis persistent key-value database                                             
  rhn-tools                 1.0 [d]              common [d]                                   Red Hat Satellite 5 tools for RHEL                                              
  ruby                      2.5 [d]              common [d]                                   An interpreter of object-oriented scripting language                            
  ruby                      2.6                  common                                       An interpreter of object-oriented scripting language                            
  rust-toolset              rhel8 [d]            common [d]                                   Rust                                                                            
  satellite-5-client        1.0 [d][e]           common [d], gui                              Red Hat Satellite 5 client packages                                             
  scala                     2.10 [d]             common [d]                                   A hybrid functional/object-oriented language for the JVM                        
  squid                     4 [d]                common [d]                                   Squid - Optimising Web Delivery                                                 
  subversion                1.10 [d]             common [d], server                           Apache Subversion                                                               
  swig                      3.0 [d]              common [d], complete                         Connects C/C++/Objective C to some high-level programming languages             
  varnish                   6 [d]                common [d]                                   Varnish HTTP cache                                                              
  virt                      rhel [d]             common [d]                                   Virtualization module                                                           
  
  CentOS-8 - PowerTools
  Name                      Stream               Profiles                                     Summary                                                                         
  javapackages-tools        201801               common                                       Tools and macros for Java packaging support                                     
  mariadb-devel             10.3                                                              MariaDB Module                                                                  
  virt-devel                rhel                                                              Virtualization module                                                           
  
  Extra Packages for Enterprise Linux Modular 8 - x86_64
  Name                      Stream               Profiles                                     Summary                                                                         
  389-directory-server      stable               minimal, legacy, default [d]                 389 Directory Server                                                            
  389-directory-server      testing              minimal, legacy, default [d]                 389 Directory Server                                                            
  avocado                   latest               minimal, default                             Framework with tools and libraries for Automated Testing                        
  cobbler                   3                    default [d]                                  Versatile Linux deployment server                                               
  libuv                     epel8-buildroot      devel [d]                                    libuv-devel for EPEL 8                                                          
  nginx                     mainline             common                                       nginx webserver                                                                 
  nodejs                    12 [x]               development, minimal, default                Javascript runtime                                                              
  nodejs                    13 [x]               development, minimal, default                Javascript runtime                                                              
  
  Remi's Modular repository for Enterprise Linux 8 - x86_64
  Name                      Stream               Profiles                                     Summary                                                                         
  glpi                      9.3                  common [d]                                   Free IT asset management software                                               
  glpi                      9.4 [d]              common [d]                                   Free IT asset management software                                               
  php                       remi-7.2             common [d], devel, minimal                   PHP scripting language                                                          
  php                       remi-7.3             common [d], devel, minimal                   PHP scripting language                                                          
  php                       remi-7.4 [e]         common [d] [i], devel, minimal               PHP scripting language                                                          
  redis                     remi-5.0             common [d]                                   Redis persistent key-value database                                             
  redis                     remi-6.0             common [d]                                   Redis persistent key-value database                                             
  
  Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
  [root@localhost ~]# dnf install @httpd:2.4/common
  Last metadata expiration check: 0:04:35 ago on Sat 09 May 2020 01:30:20 AM EDT.
  Unable to resolve argument httpd:2.4/common
  No match for package httpd
  Error: Unable to find a match
  </code></pre>
  
  <p>Same problem to community repo:</p>
  
  <pre><code>[root@localhost ~]# vim /etc/yum.repos.d/nginx.repo
  [root@localhost ~]# cat /etc/yum.repos.d/nginx.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
  
  [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
  
  [root@localhost ~]# yum-config-manager --enable nginx-mainline
  [root@localhost ~]# yum install nginx
  CentOS-8 - AppStream                                                                                        7.7 kB/s | 4.3 kB     00:00
  CentOS-8 - Base                                                                                             4.6 kB/s | 3.9 kB     00:00
  CentOS-8 - Extras                                                                                           1.6 kB/s | 1.5 kB     00:00
  Extra Packages for Enterprise Linux Modular 8 - x86_64                                                      2.7 kB/s | 8.7 kB     00:03
  Extra Packages for Enterprise Linux 8 - x86_64                                                               17 kB/s | 7.4 kB     00:00
  nginx stable repo                                                                                                                           485  B/s |  15 kB     00:31    
  nginx mainline repo                                                                                                                         4.8 kB/s |  38 kB     00:07    
  No match for argument: nginx
  Error: Unable to find a match: nginx
  </code></pre>
  
  <p>There are some my repo configuration files: </p>
  
  <pre><code>[root@localhost yum.repos.d]# ls
  CentOS-AppStream.repo   CentOS-Debuginfo.repo  CentOS-HA.repo          CentOS-Vault.repo     epel-testing-modular.repo  remi.repo
  CentOS-Base.repo        CentOS-Devel.repo      CentOS-Media.repo       epel-modular.repo     epel-testing.repo          remi-safe.repo
  CentOS-centosplus.repo  CentOS-Extras.repo     CentOS-PowerTools.repo  epel-playground.repo  nodesource-el8.repo
  CentOS-CR.repo          CentOS-fasttrack.repo  CentOS-Sources.repo     epel.repo             remi-modular.repo
  [root@localhost yum.repos.d]# cat CentOS-AppStream.repo 
  # CentOS-AppStream.repo
  #
  # The mirror system uses the connecting IP address of the client and the
  # update status of each mirror to pick mirrors that are updated to and
  # geographically close to the client.  You should use this for CentOS updates
  # unless you are manually picking other mirrors.
  #
  # If the mirrorlist= does not work for you, as a fall back you can try the
  # remarked out baseurl= line instead.
  #
  #
  
  [AppStream]
  name=CentOS-$releasever - AppStream
  mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=AppStream&amp;infra=$infra
  #baseurl=http://mirror.centos.org/$contentdir/$releasever/AppStream/$basearch/os/
  gpgcheck=1
  enabled=1
  gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
  
  [root@localhost yum.repos.d]# cat CentOS-Base.repo 
  # CentOS-Base.repo
  #
  # The mirror system uses the connecting IP address of the client and the
  # update status of each mirror to pick mirrors that are updated to and
  # geographically close to the client.  You should use this for CentOS updates
  # unless you are manually picking other mirrors.
  #
  # If the mirrorlist= does not work for you, as a fall back you can try the
  # remarked out baseurl= line instead.
  #
  #
  
  [BaseOS]
  name=CentOS-$releasever - Base
  mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=BaseOS&amp;infra=$infra
  #baseurl=http://mirror.centos.org/$contentdir/$releasever/BaseOS/$basearch/os/
  gpgcheck=1
  enabled=1
  gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
  </code></pre>
  
  <p>Some details. Some details. Some details. Some details. Some details. Some details. Some details. Some details. Some details. Some details. Some details. Some details. Some details. </p>