操作
申请域名证书
安装NGINX
创建一个配置文件
upstream github {
server github.com:443;
keepalive 16;
}
server {
listen 80;
server_name 您的域名;
rewrite ^ https://$http_host$request_uri? permanent;
}
server
{
listen 443;
server_name 您的域名;
# ssl证书地址
#指定pem文件所在路径,如果写相对路径,必须把该文件和nginx.conf文件放到一个目录下
ssl_certificate xxx;
#指定私钥文件key所在路径,如果写相对路径,必须把该文件和nginx.conf文件放到一个目录下。
ssl_certificate_key xxx;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
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;
}
}
重启Nginx
这样Github就搭建好了