关于ghs.google.com替代方法(完美实现,原创)
关于ghs.google.com替代方法(完美实现,原创)
2009年6月13日补充: 解决了共享范围的控制问题
一) 权宜的方法:
建立 ghs.yourdomain.com 做 A 指向 可用的 ghs.google.com 可用的IP
然后用 ghs.yourdomain.com 替代 ghs.google.com
缺点是: 在国内,你指向的IP可能随时被封.
优点是: 可以免费实现
二) 完美方案:
在国外申请一台机器, 利用反向代理服务器(如:squid , nginx,squid) 指向 ghs.google.com , 而 ghs.yourdomain.com域名 指向这个反向代理服务器. 我已经验证过,完全可以做到.
缺点: 需要些 Money
优点: 只要google 还在支持的服务,永远可以使用. (当然如果你自己太过分了, 连自己代理服务器的IP都被封了, 那就怪自己吧)
设置过程(这里以nginx为例):
1) 下载 nginx 比如: nginx-0.6.31.tar.gz
2) tar -zxf nginx-0.6.31.tar.gz
3) cd nginx-0.6.31
4) ./configure --prefix=/usr/local/nginx --with-http_realip_module
5) make
6) make install
7) ln -sf /usr/local/nginx/sbin/nginx /usr/sbin/nginx
8 ) 设置反向代理: 编辑 /usr/local/nginx/conf/nginx.conf ,如:
upstream hosts_yourdomain_com { -- 别名可以随便取
server ghs.google.com:80; -- ghs.google.com
}
server {
listen 80;
server_name ghs.yourdomain.com; -- 我自己的 ghs 域名
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_redirect off;
proxy_set_header Host $host;
proxy_pass http://hosts_yourdomain_com; --- 前面取的别名
proxy_set_header x-real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
9) nginx运行控制
1、检查配置文件有无语法错误 shell> nginx -t
10) 最后将你的实际域名 做 CNAME 指向 ghs.yourdomain.com. 就大功告成了.
按如下配置可以解决共享范围的控制问题: 假设限定在 *.abc.com *.efg.com 这两个域名使用 该自建的GHS服务
upstream ghs_google_com { #别名可以随便取,反向代理目的地址: Google 的 GHS
server ghs.google.com:80;
}
server {
listen 80;
server_name *.abc.com *.efg.com; #允许 *.abc.com 和 *.efg.com 通过该反向代理服务器
location / {
proxy_redirect off;
proxy_set_header Host $host;
proxy_pass http://ghs_google_com; #转向到 Google的 GHS
proxy_set_header x-real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
listen 80;
server_name *.com *.cn *.org *.mobi *.tel *.asia *.net *.name *.me *.tv *.cc *.hk *.biz *.info;
location xxxx { #表示非前面允许的域名的其他域名统统禁止通行,此处的"xxxx"是乱写的
#其实可以通过这里指向普通的Web服务(非GHS的服务).
# 于是同一个IP即可以做"自制GHS服务",又可以做其他正常的功能.
}
}








这个是什么问题.
windows下和Linux下, 配置文件的写法没有区别.
我刚刚试过了 ,windows也能做 nginx 代理. 有 nginx的windows版本
我没有试过, 但做服务器用的 大部分 不是 windows 系统吧!
http://code.google.com/p/googleappengine/issues/detail?id=1269
http://bbs.idcspy.com/thread-38215-1-1.html
看了你帖子,用亚马逊的还是要money啊,所以想找一下其他实现方法。看到上面那个帖子,可惜没有最后的结果,请看看,可以实现吗?我不懂这些东西呢。
肯定是能share ,但问题就在于能share而不能控制被share 的范围,所以不方便公开share。 并且我目前也没有花钱去做这件事 .