配置文件
#http跳转到https server { listen 80; server_name *****; return 301 https://$server_name$request_uri; } server { listen 443; server_name *****; ssl on; ssl_certificate *****.crt; ssl_certificate_key *****.key; location /{ proxy_cache one; proxy_cache_valid 200 302 1h; proxy_cache_valid 404 1m; proxy_cookie_domain google.com $server_name; #防止跳转到香港 修改Location响应头 proxy_redirect https://www.google.com.hk/ https://$server_name/ncr; proxy_redirect http://www.google.com.hk/ https://$server_name/ncr; proxy_redirect http://www.google.com https://$server_name; proxy_redirect https://www.google.com https://$server_name; proxy_pass https://www.google.com; proxy_set_header Host "www.google.com"; #防止压缩 必须写identity 空值无效 proxy_set_header Accept-Encoding identity; proxy_set_header User-Agent $http_user_agent; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Accept-Language "zh-CN"; #超链接替换 sub_filter_once off; sub_filter_types *; sub_filter www.google.com $server_name; #todo 部分超链接替换 } }