请教 Nginx 反代 google 的问题,反代 google ip 出错
- 0次
- 2021-05-26 15:05:59
- idczone
Nginx的配置如下,
server{
listen 80;
server_name abc.com www.abc.com;
return 301 https://$server_name$request_uri;
}
server{
listen 443 ssl;
ssl on;
serv抗投诉服务器er_name www.abc.com abc.com;
ssl_certificate /xxx/sslcrt/ssl.crt;
ssl_certificate_key /xxx/sslcrt/ssl.key;
location / {
proxy_redirect https://www.google.com /;
#proxy_redirect http://www.google.com /;
proxy_pass https://216.58.219.46;
#proxy_pass http://74.125.224.52;
proxy_set_header Accept-Encoding "";
proxy_set_header Accept-Language "zh-CN";
}
}
使用HTTPSgoogle IP反代google,以前一直工作很好。
昨天开始出现了https://xx.xx.xx 会重定向到www.google.com:443, 然后页面载入出错,连接被重置。
而使用 http://xx.xx.xx形式反代时,会出现 “页面重定向循环”的错误。
请问是什么原因,怎么解决?
看你vps的位置,我把vps移到日本就会302跳转,于是我把传上游的HOST改成www.google.co.jp就好了。
我的vps是美国的。
不知道你那里用https://google ip的形式能不能打开谷歌网页。感觉谷歌好像不允许这样访问了。
https://www.v2ex.com/t/154344?p=2
https://github.com/cuber/ngx_http_google_filter_module
编译教程
http://ttt.tt/162/
https://github.com/cuber/ngx_http_google_filter_module/blob/master/README.zh-CN.md
ubuntu apt-get 安装教程
http://imtx.me/archives/1934.html
谢谢了,以前没有用这个模块,是想尽量简单点配置,现在是不行了,必须得搞起复杂模式了,希望问题能够得到解决,沐浴更衣,搞起。
不带cookie会跳转
多个GGC IP负载均衡才行 用单个IP太久就会被识别为机器人
这是我用的配置 服务器是日本的 用的HE的IPv6
server
{
listen 80;
server_name www.example.org example.org;
ssl on;
ssl_certificate /root/server.crt;
ssl_certificate_key /root/server.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ALL:-ADH:+HIGH:+MEDIUM:-LOW:-SSLv2:-EXP;
location / {
proxy_redirect https://www.google.co.jp/ /;
proxy_set_header Host "www.google.co.jp";
proxy_set_header Accept-Encoding "";
proxy_set_header User-Agent $http_user_agent;
proxy_set_header Accept-Language "zh-CN";
proxy_set_header Cookie "PREF=ID=047808f19f6com346:U=0f62f33dd8549d11:FF=2:LD=zh-CN:NW=1:TM=1325338577:LM=1332142444:GM=1:SG=2:S=rE0SyJh2W1IQ-Maw";
proxy_pass https://hosts;
subs_filter www.google.co.jp example.org;
subs_filter google.co.jp example.org;
sub_filter_once off;
}
}
server
{
listen 80;
server_name www.example.org example.org;
rewrite ^(.*) https://example.org/$1 permanent;
}
upstream hosts {
server [2404:6800:4004:80c::116]:443 max_fails=3;
server [2404:6800:4004:80c::171]:443 max_fails=3;
server [2404:6800:4004:80c::185]:443 max_fails=3;
server [2404:6800:4004:80c::119]:443 max_fails=3;
server [2404:6800:4004:80c::99]:443 max_fails=3;
server [2404:6800:4004:80c::25]:443 max_fails=3;
server [2404:6800:4004:80c::212]:443 max_fails=3;
server [2404:6800:4004:80c::23]:443 max_fails=3;
server [2404:6800:4004:80c::24]:443 max_fails=3;
server [2404:6800:4004:80c::233]:443 max_fails=3;
server [2404:6800:4004:80c::116]:443 max_fails=3;
server [2404:6800:4004:80c::117]:443 max_fails=3;
server [2404:6800:4004:80c::118]:443 max_fails=3;
server [2404:6800:4004:80c::119]:443 max_fails=3;
server [2404:6800:4004:80c::120]:443 max_fails=3;
server [2404:6800:4004:80c::121]:443 max_fails=3;
server [2404:6800:4004:80c::212]:443 max_fails=3;
server [2404:6800:4004:80c::123]:443 max_fails=3;
server [2404:6800:4004:80c::241]:443 max_fails=3;
server [2404:6800:4004:80c::225]:443 max_fails=3;
server [2404:6800:4004:80c::1616]:443 max_fails=3;
server [2404:6800:4004:80c::1741]:443 max_fails=3;
server [2404:6800:4004:80c::1865]:443 max_fails=3;
server [2404:6800:4004:80c::1129]:443 max_fails=3;
server [2404:6800:4004:80c::939]:443 max_fails=3;
server [2404:6800:4004:80c::275]:443 max_fails=3;
server [2404:6800:4004:80c::4212]:443 max_fails=3;
server [2404:6800:4004:80c::233]:443 max_fails=3;
server [2404:6800:4004:80c::2422]:443 max_fails=3;
server [2404:6800:4004:80c::2323]:443 max_fails=3;
server [2404:6800:4004:80c::1216]:443 max_fails=3;
server [2404:6800:4004:80c::1197]:443 max_fails=3;
server [2404:6800:4004:80c::1108]:443 max_fails=3;
server [2404:6800:4004:80c::11a9]:443 max_fails=3;
server [2404:6800:4004:80c::12b0]:443 max_fails=3;
server [2404:6800:4004:80c::12c1]:443 max_fails=3;
server [2404:6800:4004:80c::21c2]:443 max_fails=3;
server [2404:6800:4004:80c::1263]:443 max_fails=3;
server [2404:6800:4004:80c::24a1]:443 max_fails=3;
server [2404:6800:4004:80c::22a5]:443 max_fails=3;
}
可能是单个IP的问题,现在我用HTTPS://xxx.xxx.xxx (Google IP )已经不能打开谷歌网页了。
下班试一下多IP均衡负载。
多个IP,又加上 proxy_set_header Host "www.google.com.hk"; 这句话终于又能打开了。非常感谢。
正在研究proxy_set_header 什么作用。