加速访问GitHub的方法
方法总结将GitHub的访问代理到镜像站步骤使用nginx在conf目录下新建一个github-proxy.confserver{# 监听本地的 80 端口你也可以改成其他端口如 8888listen80;# 服务器名称本地可以填 localhostserver_name localhost;# 处理所有请求location /{# 1. 关键点把请求转发给 bgithub.xyzproxy_pass https://bgithub.xyz;# 2. 关键点修改 Host 头为 bgithub.xyz这是解决 404 的核心proxy_set_header Host bgithub.xyz;# 3. 以下为推荐设置可以更好地传递用户信息# 传递真实用户的 IP 地址proxy_set_header X-Real-IP$remote_addr;# 传递代理链上的真实 IPproxy_set_header X-Forwarded-For$proxy_add_x_forwarded_for;# 传递原始的请求协议 (http 或 https)proxy_set_header X-Forwarded-Proto$scheme;# 4. 解决 SSL 证书验证问题proxy_ssl_server_name on;# 5. 跟着原请求进行重定向跳转proxy_redirect https://github.com/ https://localhost/;proxy_redirect https://bgithub.xyz/ https://localhost/;}}在nginx.conf中引入自定义配置http{# ... 其他原有配置如 include mime.types; 等保持不变 ...# 在 http 块的末尾添加这一行引入你的自定义配置include github-proxy.conf;# 注意如果有其他 server 块include 的位置要在它们之前或之后都可以# 但通常放在所有 server 块的最前面或最后面}再启动nginx即可