最新消息:

nginx 反向代理 google

google admin 5218浏览 0评论

googleaikaiyuan

 

欢迎使用  http://g.aikaiyuan.com/

 

server {
  listen 80;
  resolver 8.8.8.8;
  server_name g.aikaiyuan.com;

  ssl on;
  ssl_certificate g.aikaiyuan.com.ssl.crt;
  ssl_certificate_key g.aikaiyuan.com.ssl.key;

  location / {
    proxy_redirect off;
    proxy_pass https://www.google.com;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Accept-Encoding ""; 
    proxy_set_header User-Agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.49 Safari/537.36"; 
    proxy_set_header Accept-Language "zh-CN"; 
    proxy_set_header Cookie "PREF=ID=xxxxxx:U=yyyyy:FF=0:LD=zh-CN:NW=1:CR=2:TM=zzzz:LM=mmmmm:GM=1:SG=1:S=-nnnnn"; 
    sub_filter https://www.google.com http://g.aikaiyuan.com; 
    sub_filter_once off;
  }

  access_log off;
}

proxy_set_header Accept-Encoding “”;
#2,如果没有此项,当通过反向代理访问时会被重定向到google的站点,而不能通过反向代理访问

proxy_set_header User-Agent “Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.49 Safari/537.36”;
#3,可选,可以通过此项设置google打开的默认界面风格,此处呈现为平板的风格,如果不设置,google会自动根据浏览器判

proxy_set_header Accept-Language “zh-CN”;
#4,可选,设置界面呈现的语言,如果不设置,google会自动根据浏览器判断

proxy_set_header Cookie “PREF=ID=xxxxxx:U=yyyyy:FF=0:LD=zh-CN:NW=1:CR=2:TM=zzzz:LM=mmmmm:GM=1:SG=1:S=-nnnnn”;
#5,可选,设置cookie处理个性化设置,重点为:NW=1表示结果在新窗口中打开,LD=zh-CN表示语言为简体中文,此项将覆盖#4中的设置。(此处某些数据已编辑处理)

sub_filter www.google.com g.linzhen.net;
#6,可选,将页面中的 www.google.com 替换为g.linzhen.net,否则点击某些链接会跳回到google官方。

sub_filter_once off;

转载请注明:爱开源 » nginx 反向代理 google

您必须 登录 才能发表评论!