jenkins插件加速

使用yum安装或编译方式安装nginx
使用清华地址

配置本地hosts

#vim /etc/hosts
### jenkins ###
127.0.0.1 mirrors.jenkins-ci.org

在jenkins服务器上下载安装nginx,做个转发

nginx安装目录的conf.d目录下创建配置文件

#vim jenkins_proxy.conf
server
    {
        listen 80;
        server_name mirrors.jenkins-ci.org;

        location / {
            proxy_redirect off;
            proxy_pass https://mirrors.tuna.tsinghua.edu.cn/jenkins/;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Accept-Encoding "";
            #proxy_set_header User-Agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.49 Safari/537.36";
            proxy_set_header Accept-Language "zh-CN";
        }
        index index.html index.htm index.php;

        #error_page   404   /404.html;

        location ~ /\.
        {
            deny all;
        }

        access_log  /root/jenkins.access.log;
        error_log   /root/jenkins.error.log;
    }

启动或重启nginx

systemctl restart nginx

重启jenkins

posted @ 2020-09-12 01:20  iXiAo9  阅读(141)  评论(0编辑  收藏  举报