This article is a mirror article of machine translation, please click here to jump to the original article.

View: 30636|Reply: 6

[proxy] Nginx reverse proxy Google

[Copy link]
Posted on 12/7/2016 12:55:48 PM | | |

Recently, Google has been blocked, work efficiency has seriously declined, Baidu can't come out, just saw the CentOS.bz "Nginx Reverse Proxy Google" so I also built one, the speed is leveraged. Friends with foreign VPS can try it and declare: there is a risk, and the IP or domain name may be blocked.
Based on the lnmp one-click installation package, compile --with-http_sub_module and ngx_cache_purge-2.1 into nginx as follows:
Issue your own free SSL certificate and generate a self-signed SSL certificate for NGINX (you need to add trust when accessing.) It is also possible to use a third-party signed certificate like free startssl)

The nginx.conf configuration file is as follows(Note: 74.xx.xx.xx is replaced with a domain name or IP):
Note:
1. After listening to ports 80 and 443, you can generate certificates on Linux.
2. Define an upstream google, put 5 Google IPs (get it through the nslookup www.google.com command (yum -y install bind-utils)), if you don't do this, just wait for Google's verification code to crash.
3. A reverse proxy cache is also set up, so that some resources do not need to be repeatedly requested by Google to obtain them, speeding up the search speed
4、proxy_redirect https://www.google.com/ /; The function of this line is to replace the domain name in the 302 response header returned by Google's server with ours, otherwise the browser will still request www.google.com directly, and the reverse proxy will be invalid
5、proxy_cookie_domain google.com 74.xx.xx.xx; Replace the scope of the cookie with our domain name
6、proxy_pass http://google; Reverse proxy to Upstream Google
7、proxy_set_header Accept-Encoding ""; Prevent Google from returning compressed content, as compressed content cannot be replaced by domain names
8、proxy_set_header Accept-Language "zh-CN"; Set the language to Chinese
9、proxy_set_header Cookie "PREF=ID=047808f19f6de346:U=0f62f33dd8549d11:FF=2:LD=zh-CN:NW=1:TM=1325338577:LM=1332142444:GM=1:SG=2:S=rE0SyJh2w1IQ-Maw"; This is very important, passing fixed cookies to Google is to disable instant search, because instant search cannot replace content. There is also a setting to open the website in a new window, which is in line with our habit of opening links
10. sub_filter www.google.com 74.xx.xx.xx Of course, Google's domain name is replaced with ours, pay attention to the need to install the nginx sub_filter module (compile plus --with-http_sub_module parameter)





Previous:nginx cross-domain resource sharing CORS to add response headers
Next:nginx: [error] open() /nginx.pid failed (2: No such file or directory)
 Landlord| Posted on 12/22/2016 5:27:02 PM |
liyunong Posted on 2016-12-22 16:54
Why do I use this, I don't know how to use it, I need to know how to go to google now, can the landlord teach me?

https://eyun.baidu.com/s/3miFcunQ     提取码 :HTTPS 解码密码:LAOD
Posted on 12/22/2016 4:54:48 PM |
Why do I use this, I don't know how to use it, I need to know how to go to google now, can the landlord teach me?
Posted on 12/22/2016 6:37:26 PM |
Small slag Posted on 2016-12-22 17:27
https://eyun.baidu.com/s/3miFcunQ     提取码 :HTTPS 解码密码:LAOD

What Dongdong, download it and take a look
Posted on 12/22/2016 6:39:50 PM |
Small slag Posted on 2016-12-22 17:27
https://eyun.baidu.com/s/3miFcunQ     提取码 :HTTPS 解码密码:LAOD

Thanks, it turns out that you can go to the hosts file of google.
Posted on 8/2/2021 5:44:01 PM |
It is worth learning from, thank you!
Posted on 12/30/2021 6:16:12 PM |
What Dongdong, download it and take a look
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com