利用vps架设ghs的反向代理

ghs.google.com在国内是被墙掉的。之前有介绍过有人提供免费的ghs可用ip。不过如果你自己有一台国外的vps或者服务器,完全可以自己来架设该服务。

主要说一下nginx和apache下的配置.

Nginx

upstream ghs { ip_hash; server ghs.google.com; server 72.14.203.121; server 72.14.207.121; server 74.125.43.121; server 74.125.47.121; server 74.125.53.121; server 74.125.77.121; server 74.125.93.121; server 74.125.95.121; server 74.125.113.121; server 216.239.32.21; server 216.239.34.21; server 216.239.36.21; server 216.239.38.21; }

server { listen 80; server_name ghs.yourdomain.com fengli.su; location / { proxy_redirect off; proxy_set_header Host $host; proxy_pass http://ghs; proxy_set_header? x-real-IP? $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } }

Apache

<VirtualHost *:80> ServerName ghs.yourdomain.com ServerAlias? www.domain.com #此处罗列所有需要反向代理至ghs.google.com的域名,域名和域名之间用空格隔开 ProxyRequests off <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPreserveHost on ProxyPass / http://ghs.google.com/ ProxyPassReverse / http://ghs.google.com/ </VirtualHost>