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)
|