【Nginx】--反向代理

最近项目需要访问谷歌服务器,现在谷歌被禁了之后只能通过香港代理,特研究了下ng的反向代理

location /

{

  #配置需要代理访问的地址 proxy_pass https:
//mt0.google.cn;   #配置请求头的host域名 proxy_set_header Host mt0.google.cn; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE-HOST $remote_addr; add_header X-Cache $upstream_cache_status; #Set Nginx Cache proxy_set_header Accept-Encoding ""; sub_filter "https://mt0.google.cn" "http://www.xxx.com"; sub_filter_once off; proxy_ignore_headers Set-Cookie Cache-Control expires; add_header Cache-Control no-cache; }
作者:Reno灬 出处:https://www.cnblogs.com/import-new/ 版权归作者所有,转载请注明出处
原文地址:https://www.cnblogs.com/import-new/p/15224173.html