Nginx reverse proxy request YUM

First, install Nginx configuration service (recommended on Nginx server to turn off iptables / firewalld service until after the completion of the experiment according to the actual situation)

[the root @ localhost ~] # yum the install Nginx - Y # install the Nginx 
[the root @ localhost ~] # CD /etc/nginx/conf.d/ 
[the root @ localhost the conf.d] Vim proxy.conf #   # configure proxy rules 
server { 
the listen 80 ; 
server_name mirrors.qiangungun.com;   
LOCATION   / CentOS / {          #yum Base source agent configuration 
   proxy_pass http: // mirrors.aliyun.com/centos/; 
  } 
LOCATION   / EPEL / {           #yum EPEL source agent disposed 
   proxy_pass http : // mirrors.aliyun.com/epel/; 
  } 
} 
# If there are other agents need YUM reference to the above configuration to [the root @ localhost the conf.d] # Nginx
-t # syntax checking and restart nginx: the Configuration File at The /etc/nginx/nginx.conf syntax IS the ok nginx: the Configuration File /etc/nginx/nginx.conf the Test IS successful
[root @ localhost conf.d] # systemctl restart nginx

Second, the client configuration yum source address access

Configure base source

# 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.
#
#
 
[base]
name=CentOS-$releasever - Base - mirrors.qiangungun.com
failovermethod=priority
baseurl=http://mirrors.qiangungun.com/centos/$releasever/os/$basearch/
        
        
gpgcheck=1
gpgkey=http://mirrors.qiangungun.com/centos/RPM-GPG-KEY-CentOS-7
 
#released updates 
[updates]
name=CentOS-$releasever - Updates - mirrors.qiangungun.com
failovermethod=priority
baseurl=http://mirrors.qiangungun.com/centos/$releasever/updates/$basearch/
        
        
gpgcheck=1
gpgkey=http://mirrors.qiangungun.com/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.qiangungun.com
failovermethod=priority
baseurl=http://mirrors.qiangungun.com/centos/$releasever/extras/$basearch/
        
        
gpgcheck=1
gpgkey=http://mirrors.qiangungun.com/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.qiangungun.com
failovermethod=priority
baseurl=http://mirrors.qiangungun.com/centos/$releasever/centosplus/$basearch/
        
        
gpgcheck=1
enabled=0
gpgkey=http://mirrors.qiangungun.com/centos/RPM-GPG-KEY-CentOS-7
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.qiangungun.com
failovermethod=priority
baseurl=http://mirrors.qiangungun.com/centos/$releasever/contrib/$basearch/
        
        
gpgcheck=1
enabled=0
gpgkey=http://mirrors.qiangungun.com/centos/RPM-GPG-KEY-CentOS-7
vim /etc/yum.repos.d/CentOS-Base.repo

Configuration epel source

[warm] 
name = Extra Packages for Enterprise Linux 7 - $ basearch 
baseurl = http: // mirrors.qiangungun.com/epel/7/$basearch 
failovermethod = priority 
enabled = 1 
gpgcheck = 0 
gpgkey = file: /// etc / PKI / rpm-gpg / rPM-gPG-KEY-mild-7 
 
[warm - debuginfo] 
name = Extra Packages for Enterprise Linux 7 - $ basearch - Debug 
baseurl = http: // mirrors.qiangungun.com/epel/7/$ basearch / debug
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=0
 
[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
baseurl=http://mirrors.qiangungun.com/epel/7/SRPMS
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=0
vim /etc/yum.repos.d/epel-7.repo

# The above operation will mainly replace the repo file in the specified domain name Nginx proxy server_name in the current lab environment, namely: mirrors.qiangungun.com

Third, the machine is provided parsing hosts

[@ the rsync the root-Client yum.repos.d] # Vim / etc / the hosts
 127.0 . 0.1    localhost localhost.localdomain localhost4 localhost4.localdomain4 
:: . 1          localhost localhost.localdomain localhost6 localhost6.localdomain6
 172.16 . 150.131 mirrors.qiangungun.com   # 172.16 .150.131 Nginx server is configured to address mirrors.qiangungun.com Nginx proxy server_name the domain name and repo files also need to be consistent domain name

Fourth, the test

[@ rsync- the root Client yum.repos.d] # of ping mirrors.qiangungun.com    # test hosts configuration 
[@ the rsync the root -client yum.repos.d] # yum makecache                  # test request yum

Copy to self: https://www.jb51.net/article/153773.htm

 

Guess you like

Origin www.cnblogs.com/panwenbin-logs/p/11458604.html