location / { proxy_ssl_server_name on; expires 3d; proxy_set_header Accept-Encoding ''; root /www/wwwroot/【域名】; proxy_store on; proxy_store_access user:rw group:rw all:rw; proxy_temp_path /www/wwwroot/【域名】; if ( !-e $request_filename) { proxy_pass https://raw.githubusercontent.com; } }
可以通过上述代码在宝塔创建反向代理后,通过修改配置文件搭建镜像站,用来搭建github下载镜像比较方便,同时文件会在网站目录下保存,可以反向代理https网站
或者利用nginx搭建任意网站镜像
location / { proxy_set_header Accept-Encoding ""; proxy_set_header Connection ""; proxy_http_version 1.1; proxy_connect_timeout 10s; proxy_read_timeout 10s; proxy_set_header Host github.com; proxy_hide_header Strict-Transport-Security; #隐藏协议头,避免因为反向代理开启hsts proxy_pass https://github.com; }