Using Nginx proxy Google

Source: Internet
Author: User

My nginx server in Hong Kong, directly in the Nginx configuration file to add a bit of content can be

Proxy_cache_path  conf/cache/one  levels=1:2   keys_zone=one:10m max_ size=10g;proxy_cache_key   "$host $request_uri";server {    listen 80;     server_name g.example.com;    access_log  /var/log/ nginx/access.log;    rewrite ^ (. *)  https://g.example.com$1 permanent;} upstream google {        server 173.194.127.212;         server 173.194.127.208;         server 173.194.127.209;        server  173.194.127.210;        server 173.194.127.211;} server {            listen       443;            server_name  g.example.com;             access_log  /var/log/nginx/access.log;                 ssl on;                 ssl_certificate ssl/g.crt;                 ssl_ certificate_key ssl/g.key;        location / {                 proxy_cache one ;                 proxy_cache_ valid  200 302  1h;                 p roxy_cache_valid  404      1m;                 proxy_redirect off;                 proxy_pass https:// www.google.com.hk/;                 proxy_redirect https://www.google.com.hk/ /;                 proxy_cookie_domain www.google.com g.example.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   $http _user_agent;                 proxy_set_header Accept-Language  "ZH-CN";                 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 ";                 subs_filter www.google.com g.example.com;        }}

Last visit to http://g.example.com can be Oh!!! Come and try it!!!



This article from "Linux" blog, declined reprint!

Using Nginx proxy Google

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.