V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
arnofeng
V2EX  ›  互联网

通过 nginx 搞了一个反代,整合 谷歌学术, V2EX ,知乎等搜索的页面

  •  4
     
  •   arnofeng · 2015-09-01 18:26:48 +08:00 · 15726 次点击
    这是一个创建于 3161 天前的主题,其中的信息可能已经有所发展或是发生改变。

    原由

    • 由于学校打不开谷歌学术,手机并不想总是开着 SS 之类。
    • 方便检索 谷歌学术, V2EX ,知乎,百度网盘, Stackoverflow 等

    网址和注意事项

    • https://g.adminhost.org/
    • 不要直接点击链接,需要复制到网址栏或者加书签(否则会 return 403 )
    • 不要宣传的说,希望只是方便使用而已

    一些无所谓的说明

    1.Use SSL/https to ensure safety;
    2.Forbid popular spiders like Google 、 Baidu;
    3.Forbid any illegal refer;
    4.Forbid any illegal robot;
    5.Limit frequency of the same IP at 10 times in 1 second;
    6.Can only access this site by typing the domian or using bookmarks;
    7.If pages show "403 Forbid",try to delete "cookies" in your browser;

    第 1 条附言  ·  2015-09-05 21:30:42 +08:00

    详细介绍点我

    可以使用的域名(不要直接点,最后两个是 http )

    • g.adminhost.org
    • blogfeng.tk
    • www.blogfeng.tk
    • img.blogfeng.com
    • js.blogfeng.com
    第 2 条附言  ·  2016-01-01 21:43:09 +08:00
    大家好,已经于 20160101 开源,地址 https://github.com/arnofeng/ngx_google_deployment
    141 条回复    2017-01-21 18:46:30 +08:00
    1  2  
    luckykong
        101
    luckykong  
       2016-01-01 22:31:45 +08:00
    @arnofeng 好像有错误
    ···
    echo "your google search domain is $DOMAIN2"
    echo "your google scholar domain is $DOMAIN1"
    echo -n "Enter any key to continue ... "
    ···
    这部分, domain2 和 domain1 ,是不是搞混了?
    arnofeng
        102
    arnofeng  
    OP
       2016-01-01 22:37:22 +08:00
    @luckykong 谢谢,我修复下
    GPU
        103
    GPU  
       2016-01-02 01:04:17 +08:00
    @arnofeng 撒花。 明天部署一个。 么么哒。
    sky170
        104
    sky170  
       2016-01-02 01:29:41 +08:00
    感谢开源
    arnofeng
        105
    arnofeng  
    OP
       2016-01-02 15:44:00 +08:00
    @GPU 部署哪儿啦 给我看看
    @sky170 应该的
    GPU
        106
    GPU  
       2016-01-02 17:30:34 +08:00
    @arnofeng 还没有呢 。 今天赶着把路由器搞好。
    GPU
        107
    GPU  
       2016-01-03 16:06:07 +08:00
    @arnofeng 貌似用不到啊 。

    g.iu.vc : ERR_EMPTY_RESPONSE
    x.iu.vc : 跳回去谷歌域名了
    GPU
        108
    GPU  
       2016-01-03 16:27:56 +08:00
    @arnofeng 不明真相 。重啓了幾次 nginx 之後 ,現在又正常了 。 配置文件都沒有動過 。

    只有把日誌記錄的註釋取消掉 ,現在又加回去又正常了。
    arnofeng
        109
    arnofeng  
    OP
       2016-01-03 16:32:38 +08:00
    arnofeng
        110
    arnofeng  
    OP
       2016-01-03 18:21:11 +08:00 via Android
    @GPU 你的现在还有问题,学术倒是没问题。有没有再装一次?
    GPU
        111
    GPU  
       2016-01-03 19:23:30 +08:00
    @arnofeng 现在应该好了 , g.iu.vc 解析了两个不同 ip
    arnofeng
        112
    arnofeng  
    OP
       2016-01-03 19:37:12 +08:00
    @GPU 你的还是不行,用下面的命令更新下 nginx.conf
    https://github.com/arnofeng/ngx_google_deployment/issues/1
    GPU
        113
    GPU  
       2016-01-03 19:40:40 +08:00
    @arnofeng 已更新。
    GPU
        114
    GPU  
       2016-01-03 19:41:19 +08:00
    @arnofeng 直接打开 x.iu.vc 还是跳
    arnofeng
        115
    arnofeng  
    OP
       2016-01-03 19:50:27 +08:00
    @GPU 已经根据你的问题测试和分析
    原因找到了 是由于你是香港服务器, google 会根据你的地理位置 加.hk 所以很多时间会跳转。
    arnofeng
        116
    arnofeng  
    OP
       2016-01-03 19:53:39 +08:00
    GPU
        117
    GPU  
       2016-01-03 20:15:01 +08:00
    @arnofeng 明白了.
    arnofeng
        118
    arnofeng  
    OP
       2016-01-03 21:03:01 +08:00
    @GPU 用了 ncr 方式 解决地区服务器问题 可以麻烦你再更新 nginx.conf 吗
    GPU
        119
    GPU  
       2016-01-03 21:35:48 +08:00
    @arnofeng 已经更新并重启 ,用的是 #116 链接里面的更新方法.
    arnofeng
        120
    arnofeng  
    OP
       2016-01-03 21:38:54 +08:00
    @GPU 那个方式也换了。直接更新 conf 脚本,
    wget -N --no-check-certificate https://raw.githubusercontent.com/arnofeng/ngx_google_deployment/master/install.sh

    bash install.sh

    选择 "update nginx.conf"。
    GPU
        121
    GPU  
       2016-01-03 22:19:32 +08:00
    @arnofeng 我是这样子更新的啊 . 你 issues 里面就是这样子.
    arnofeng
        122
    arnofeng  
    OP
       2016-01-03 22:48:10 +08:00
    @GPU 你的还有问题不?我已经用 HK 服务器实测过没问题了
    GPU
        123
    GPU  
       2016-01-03 23:41:39 +08:00
    @arnofeng 应该没有了 . 学术与 Google 都试过了.
    arnofeng
        124
    arnofeng  
    OP
       2016-01-04 07:57:29 +08:00 via Android
    @GPU index.html 更新过了,你可以手动替换
    GPU
        125
    GPU  
       2016-01-04 08:17:59 +08:00
    @arnofeng 好 der
    GPU
        126
    GPU  
       2016-01-04 08:45:55 +08:00
    @arnofeng 现在的问题是搜索之后跳到 https 了, 但是域名并没有改变。然而我没有开启 https

    还有是如果直接打开 g.iu.vc/search 就会跳到 https://encrypted.google.com/webhp
    arnofeng
        127
    arnofeng  
    OP
       2016-01-04 08:54:36 +08:00
    @GPU 是我的问题,我写成了 https 了,已经修复,更新 index.html 即可,全文替换你的域名
    GPU
        128
    GPU  
       2016-01-04 09:12:03 +08:00
    @arnofeng 我直接写成
    goto("//x.iu.vc/scholar?hl=zh-CN&q="+encodeURIComponent(keyword2.value)+"&btnG=&lr=")

    这样子应该可以直接支持 https 与 http
    arnofeng
        129
    arnofeng  
    OP
       2016-01-04 09:14:13 +08:00
    @GPU 你这是个好办法 哈哈
    GPU
        130
    GPU  
       2016-01-04 09:55:12 +08:00
    @arnofeng 刚刚试了试 wenlu 的模块貌似配置你的也是可以 。 有人说 wenlu 的一定要 https 貌似也不是啊。
    GPU
        131
    GPU  
       2016-01-04 09:56:47 +08:00
    @arnofeng 还有一个问题是 ,直接访问 Google 的话打开的是白色界面没有顶部黑条 。但是反代的就有。不明为什么是这样子。
    arnofeng
        132
    arnofeng  
    OP
       2016-01-04 10:00:14 +08:00
    @GPU 因为我的都是原装原生的 nginx ,所以自己想干嘛就干嘛。自己的配置最好放到 /etc/nginx/vhost 文件夹下面,方便更新不影响。 wen.lu 的我没用过,不过很多人提了,应该是把配置文件封装成 nginx 的插件了。不过 google 的服务器会调整的,所以我的 nginx.conf 需要相应优化,所以我做了 update 功能。 wen.lu 的貌似跟我的是重复功能,二选一吧。我的配置都是可见的,查看下 nginx.conf ,都有详细注释。
    arnofeng
        133
    arnofeng  
    OP
       2016-01-04 10:04:19 +08:00
    @GPU 1.直接开 google 是有黑色的,但是黑色上面是 Google+、图片等链接 2.反代没有,是因为根据我的配置,所有的 google.com 的资源都用反代域名替换了,顶部黑条原来使用 js 方式显示链接,我的反代配置会让它消失。
    GPU
        134
    GPU  
       2016-01-04 10:16:12 +08:00


    我直接打开国际版是没有的,用了 ncr 的。
    arnofeng
        135
    arnofeng  
    OP
       2016-01-04 10:19:06 +08:00
    @GPU 我有= = ncr
    GPU
        136
    GPU  
       2016-01-04 10:25:29 +08:00
    @arnofeng 可能就像是你说的 , 没有反代哪个白色的东西 。 然后就显示黑色了。
    arnofeng
        137
    arnofeng  
    OP
       2016-01-07 21:59:09 +08:00 via Android
    @GPU 已经修改为你想要的。因为直接通过的是隐私保护谷歌域名,所以不一样。现在走的正常的。
    GPU
        138
    GPU  
       2016-01-07 22:12:51 +08:00
    @arnofeng 好的好的。 。给力哦。
    arnofeng
        139
    arnofeng  
    OP
       2016-01-07 22:25:30 +08:00
    @GPU 你的是两个结合 学术那里搜索后 再点击搜索那个图标 就会报错哦。
    GPU
        140
    GPU  
       2016-01-07 23:28:45 +08:00
    @arnofeng 是哦 。不过我也不想修了。 够用就好了。
    wkl17
        141
    wkl17  
       2017-01-21 18:46:30 +08:00
    看完描述 第一反应 就想到了应该是用了 refer 判断的方式。
    不知道楼主是否有研究过 屏蔽 360 云盾之类的检测的想法?
    我之前观察了一下,只要用 360 浏览器访问过,
    接着就会看到至少 2 个 IP 的来访,而且 UserAgent 跟普通用户无异,
    不像 spider 的 UserAgent 。所以无法通过判断 UserAgent 的方式屏蔽。
    可有什么好的方法屏蔽它的抓取、检测?
    我之前想到的方式是,默认访问时 弹出一个确认框,让用户手动点提交,然后生成 cookie 或 session ,接下来以它作为凭证。但还未去实践过。看到此帖,抛出来探讨一下。
    1  2  
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3003 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 14:10 · PVG 22:10 · LAX 07:10 · JFK 10:10
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.