方法一、手动配置Nginx实现
记得替换一下SSL证书目录
upstream github {
server github.com:443;
}
server
{
listen 80;
listen 443 ssl http2 reuseport;
ssl_certificate /www/server/panel/vhost/cert/<pem证书>;
ssl_certificate_key /www/server/panel/vhost/cert/<key秘钥>;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_session_timeout 1d;
ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+ECDSA+AES128:EECDH+aRSA+AES128:RSA+AES128:EECDH+ECDSA+AES256:EECDH+aRSA+AES256:RSA+AES256:EECDH+ECDSA+3DES:EECDH+aRSA+3DES:RSA+3DES:!MD5;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_tickets on;
ssl_stapling on;
server_name <绑定的域名>;
if ($http_user_agent ~* "qihoobot|Baiduspider|Googlebot|Googlebot-Mobile|Googlebot-Image|Mediapartners-Google|Adsbot-Google|Feedfetcher-Google|Yahoo! Slurp|Yahoo! Slurp China|YoudaoBot|Sosospider|Sogou spider|Sogou web spider|MSNBot|ia_archiver|Tomato Bot") #防止搜索引擎收录
{
return 403;
}
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;
}
}
方法二、通过宝塔面板配置
1.点击左侧栏的网站->添加站点
添加一个静态页面站点,不需要数据库啥的
2.修改创建好的站点->点击反向代理->添加反向代理
切记不要开启缓存,否则短时间连续git push会被拒绝
高级功能我也不知道有啥用,姑且就先开着吧