Nginx reverse proxy, Google has been not easy to open, if you have a foreign VPS or server, you can easily solve this problem, this time the protagonist is Nginx,nginx reverse agent has now developed very powerful, Often take him to do load balancing, of course, this time only talk about his reverse proxy site, some people also take it to do thief program.
This time will use a nginx module, if not installed please go to the official website:
Https://github.com/yaoweibin/ngx_http_substitutions_filter_module
There are detailed installation instructions, you need to recompile the nginx.
Below the Nginx configuration, if we want to bind the domain name is Www.abc.com,google address is www.abc.com/google/
The configuration is as follows:
Location/Google {proxy_set_header Accept-encoding""; Proxy_redirect http://www.google.com/http://www.abc.com/google/;Proxy_pass http://www.google.com/;Proxy_set_header x-real-IP $remote _addr; Proxy_set_header X-forwarded-For $proxy _add_x_forwarded_for; Subs_filter'www.google.com' 'Www.abc.com/google'; Subs_filter'href= "/' 'href= "http://www.abc.com/google/'; Subs_filter'<form action= "/' '<form action= "http://www.abc.com/google/';}
restart Nginx, visit www.abc.com/google/to Google and then post a Twitter: c#location/ Twitter {proxy_set_header accept-encoding "";p roxy_redirect Https://mobile.twitter.com/https://www.abc.com/twitter /;p roxy_pass https://mobile.twitter.com/;subs_filter mobile.twitter.com www.abc.com/twitter;subs_filter ' href= '/' Href= "https://www.abc.com/twitter/"; Subs_filter ' <form action= "/" <form action= "Https://www.abc.com/twitter /'; Subs_filter ' t.co ' www.abc.com/t.co ';} location/t.co {Proxy_pass http://t.co/;} Location/twitter {proxy_set_header accept-encoding "";p roxy_redirect https://mobile.twitter.com/https:// www.abc.com/twitter/;p roxy_pass https://mobile.twitter.com/;subs_filter mobile.twitter.com www.abc.com/twitter; Subs_filter ' href= '/' href= ' https://www.abc.com/twitter/'; Subs_filter ' <form action= '/' <form action= ' https ://www.abc.com/twitter/'; Subs_filter ' t.co ' www.abc.com/t.co ';} location/t.co {proxy_pass http://t.co/;}
This need to open the SSL function, that is, HTTPS access, this is not difficult, I have introduced before, how to get the browser can be certified free SSL certificate.
Nginx Reverse proxy Google