返回 首页

自建Pypi反向代理服务器


用于客户机器无法联网, 但是局域网内有其他电脑可以联网的情况下使用pip安装依赖包.

使用Nginx反向代理即可:

server {
        listen 38888 default_server;

        index index.html index.htm index.nginx-debian.html;

        server_name _;

        location /simple {
                proxy_pass https://pypi.doubanio.com;
        }
        location /packages {
                proxy_pass https://pypi.doubanio.com;
        }
}

安装时指定trusted-host, 比如:

pip install requests -i http://ip:38888/simple --trusted-host=*

登录