pip install <something>不会从devpi-server下载软件包

时间:2018-11-28 06:56:15

标签: nginx caching pip devpi

我有一个http://localhost:3141上运行的devpi服务器。本机的IP为10.75.213.161。如果我在这台计算机上进行了pip安装,它将从该索引http://localhost:3141/cloud-labs/dev/+simple/下载。

我尝试从另一台机器10.75.213.189执行此操作。我会 pip install re2 返回,

Looking in indexes: http://10.75.213.161/cloud-labs/dev/+simple
Collecting re2
  HTTP error 502 while getting http://10.75.213.161/root/pypi/+f/1d3/903832351b9a4/re2-0.2.22.tar.gz#sha256=1d3903832351b9a4bdcc1da68ad75529d4fa69adfcad40bbdb2bf43869d4743f (from http://10.75.213.161/cloud-labs/dev/+simple/re2/)
  Could not install requirement re2 from http://10.75.213.161/root/pypi/+f/1d3/903832351b9a4/re2-0.2.22.tar.gz#sha256=1d3903832351b9a4bdcc1da68ad75529d4fa69adfcad40bbdb2bf43869d4743f because of error 502 Server Error: Bad Gateway for url: http://10.75.213.161/root/pypi/+f/1d3/903832351b9a4/re2-0.2.22.tar.gz
Could not install requirement re2 from http://10.75.213.161/root/pypi/+f/1d3/903832351b9a4/re2-0.2.22.tar.gz#sha256=1d3903832351b9a4bdcc1da68ad75529d4fa69adfcad40bbdb2bf43869d4743f because of HTTP error 502 Server Error: Bad Gateway for url: http://10.75.213.161/root/pypi/+f/1d3/903832351b9a4/re2-0.2.22.tar.gz for URL http://10.75.213.161/root/pypi/+f/1d3/903832351b9a4/re2-0.2.22.tar.gz#sha256=1d3903832351b9a4bdcc1da68ad75529d4fa69adfcad40bbdb2bf43869d4743f (from http://10.75.213.161/cloud-labs/dev/+simple/re2/)

10.75.213.189上的/root/.pip/pip.conf看起来像这样,

 [global]
    index_url = http://10.75.213.161/cloud-labs/dev/+simple
    trusted-host = 10.75.213.161
    [search]
    index = http://10.75.213.161/cloud-labs/dev/+simple



The /etc/nginx/conf.d/default.conf 
server {
    server_name localhost $hostname "";
    listen 0.0.0.0:80;

    location / {
        root   /usr/share/nginx/html;
        index  http://localhost:3141/;
        proxy_pass  http://localhost:3141/;
}
    gzip             on;
    gzip_min_length  2000;
    gzip_proxied     any;
#    gzip_types       text/html application/json;

    proxy_read_timeout 60s;
    client_max_body_size 64M;

    # set to where your devpi-server state is on the filesystem
    root /tmp/home/mydevpiserver;

    # try serving static files directly
    location ~ /\+f/ {
        # workaround to pass non-GET/HEAD requests through to the named location below
        error_page 418 = @proxy_to_app;
        if ($request_method !~ (GET)|(HEAD)) {
            return 418;
        }

        expires max;
        try_files /+files$uri @proxy_to_app;
    }
    # try serving docs directly
    location ~ /\+doc/ {
        try_files $uri @proxy_to_app;
    }
 # location / {
        # workaround to pass all requests to / through to the named location below
   #     error_page 418 = @proxy_to_app;
    #    return 418;
  #  }
    location @proxy_to_app {
        proxy_pass http://localhost:4040;
        proxy_set_header X-outside-url $scheme://$host:$server_port;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

但是链接http://10.75.213.161/cloud-labs/dev/+simple/re2实际上是可访问的。如果我确实使用http://10.75.213.161/cloud-labs/dev/+simple/re2,它实际上会下载HTML文件。

我要执行什么配置,以便pip安装软件包才能下载它。

0 个答案:

没有答案