概述
nginx代理阿里云yum源
由于本地服务器不能访问公网,没有yum源安装依赖包的时候不是特别方便,就需要通过能访问公网的服务器部署nginx代理。
1、部署nginx服务
yum install nginx -y
systemctl start nginx
systemctl enable nginx
2、配置nginx代理阿里yum源
2、在创建子配置文件
[root@nginx1 ~]# cat /etc/nginx/conf.d/nginx1.conf
server{
listen 16666;
server_name _;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers X-Requested-With;
add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
location / {
root html;
index index.html index.htm;
}
location /centos/ {
proxy_pass http://mirrors.aliyun.com/centos/;
}
location /epel/ {
proxy_pass http://mirrors.aliyun.com/epel/;
}
location /mariadb/ {
proxy_pass http://mirrors.ustc.edu.cn/mariadb/;
}
}
3、在内网服务器配置yum地址
[base]
name=CentOS-$releasever - Base - 192.168.16.132:16666
failovermethod=priority
baseurl=http://192.168.16.132:16666/centos/$releasever/os/$basearch/
http://192.168.16.132:16666/centos/$releasever/os/$basearch/
# http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://192.168.16.132:16666/centos/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates - 192.168.16.132:16666
failovermethod=priority
baseurl=http://192.168.16.132:16666/centos/$releasever/updates/$basearch/
http://192.168.16.132:16666/centos/$releasever/updates/$basearch/
# http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://192.168.16.132:16666/centos/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - 192.168.16.132:16666
failovermethod=priority
baseurl=http://192.168.16.132:16666/centos/$releasever/extras/$basearch/
http://192.168.16.132:16666/centos/$releasever/extras/$basearch/
# http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://192.168.16.132:16666/centos/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - 192.168.16.132:16666
failovermethod=priority
baseurl=http://192.168.16.132:16666/centos/$releasever/centosplus/$basearch/
http://192.168.16.132:16666/centos/$releasever/centosplus/$basearch/
# http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://192.168.16.132:16666/centos/RPM-GPG-KEY-CentOS-7
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - 192.168.16.132:16666
failovermethod=priority
baseurl=http://192.168.16.132:16666/centos/$releasever/contrib/$basearch/
http://192.168.16.132:16666/centos/$releasever/contrib/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://192.168.16.132:16666/centos/RPM-GPG-KEY-CentOS-7
最后
以上就是愤怒大神为你收集整理的nginx代理阿里云yum源nginx代理阿里云yum源的全部内容,希望文章能够帮你解决nginx代理阿里云yum源nginx代理阿里云yum源所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复