yum使用nginx http代理

公司有一台电脑A不能访问外网,需要在这台电脑上安装软件,使用yum安装,可以自动安装匹配的版本,在网上查了下可以使用http代理,刚好另外一台电脑B可以访问外网并安装nginx,于是增加照着配置了一下,给电脑B增加下面两个代理

server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}


        location /centos/ {
            proxy_pass http://mirrors.aliyun.com/centos/;
            proxy_max_temp_file_size 0;
        }
        location /kubernetes/ {
            proxy_pass http://mirrors.aliyun.com/kubernetes/;
            proxy_max_temp_file_size 0;
        }

 

说明一下,刚开始没有添加 proxy_max_temp_file_size,下载软件经常碰到[Errno 14] curl#18 - "transfer closed with xxx bytes remaining to read"的错误,开始还以为电脑A还需要进行其他配置,后面试了了小软件git,发现安装成功了,才注意到是rpm包没下载完,然后在网上搜这个[Errno 14] curl#18的解决方法,参考下面的文章添加了该参数,之前没下载完的rpm包接着都下载完成了。

参考连接:https://blog.csdn.net/qq_21127151/article/details/90549080

 

补充电脑A的yum源修改方法:

将mirrors.aliyun.com修改成电脑B的IP

[kubernetes]
name=Kubernetes
baseurl=http://电脑B的IP/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=http://电脑B的IP/kubernetes/yum/doc/yum-key.gpg http://电脑B的IP/kubernetes/yum/doc/rpm-package-key.gpg

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值