2016年5月4日星期三

反代Blogger解决国内无法访问以及开启SSL

需求:
  • Blogger博客(blog.ohrz.net/renzhn.blogspot.com)被墙,国内无法访问
  • blog.ohrz.net原本是CNAME到ghs.google.com,相当于renzhn.blogspot.com的别名
  • Blogger后台可以自定义域名,但是自定义域名还不支持https
解决:
  • 在自已的VPS上架设反向代理(Reverse Proxy),然后把域名指向VPS
  • 访问过程:用户->VPS->ghs.google.com(blog.ohrz.net/renzhn.blogspot.com)->VPS->用户
  • 使用Nginx作为反向代理
效果:
  • 国内可以访问
  • 可以“开启”SSL支持
Nginx配置文件:

server {
        listen 80;
        server_name blog.ohrz.net;
        location / {
                proxy_pass http://ghs.google.com:80;
                proxy_set_header X-Real-IP  $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Host $host;
        }
}

server {
        listen 443 ssl;
        server_name blog.ohrz.net;
        ssl_certificate /etc/nginx/ssl/nginx.crt;
        ssl_certificate_key /etc/nginx/ssl/nginx.key;
        location / {
                proxy_pass http://ghs.google.com:80;
                proxy_set_header X-Real-IP  $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto https;
                proxy_set_header X-Forwarded-Port 443;
                proxy_set_header Host $host;
        }
}

2 条评论:

  1. 所以请问下 blog.ohrz.net这个域名是仍然作为blogger的别名了吗 是blog.ohrz.net这个域名指向vps吗?

    回复删除
  2. Why casinos are rigged - Hertzaman - The Herald
    In the UK, casino games are rigged and there is ventureberg.com/ evidence 바카라 of 토토 사이트 fraud, crime or disorder or an individual's involvement. There are aprcasino also many

    回复删除