Skip to content

Commit e7cb044

Browse files
committed
new post
1 parent 8fdc3ae commit e7cb044

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed
File renamed without changes.

_posts/2016-02-19-baidu-spider.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
layout: post
3+
title: 解决百度爬虫无法抓取github pages
4+
category: Unix/Linux
5+
tag: [github]
6+
---
7+
8+
由于Github Pages禁止了百度爬虫,导致自己的博客无法被百度索引到,使用七牛云和又拍云做镜像存储能解决问题,但是要求域名要备案,由于我的域名从Godaddy上购买的,国内备案手续太复杂,故放弃了CDN的办法,琢磨了一段时间找到了Gitcafe的解决办法。
9+
10+
##解决方案
11+
12+
既然不想放弃Github,唯一的办法就是不让百度爬虫直接抓取GIthub的内容,而是抓取自己网站的一个镜像,将网站的内容镜像到[gitcafe](www.gitcafe.com),步骤如下:
13+
14+
* 注册 gitcafe 帐号
15+
* 创建一个跟用户名一样的项目,比如我的[https://gitcafe.com/ezlippi/ezlipp](https://gitcafe.com/ezlippi/ezlippi)
16+
* 把 github 的项目推到 gitcafe 上面去,步骤如下:
17+
18+
{% highlight bash shell %}
19+
git remote add gitcafe https://gitcafe.com/ezlippi/ezlippi.git
20+
git checkout -b gitcafe-pages
21+
切换到一个新分支 'gitcafe-pages'
22+
git push gitcafe master:gitcafe-pages
23+
Username for 'https://gitcafe.com':ezlippi
24+
Password for 'https://[email protected]'
25+
Counting objects: 17, done.
26+
Delta compression using up to 4 threads.
27+
Compressing objects: 100% (10/10), done.
28+
Writing objects: 100% (10/10), 1.06 KiB | 0 bytes/s, done.
29+
Total 10 (delta 8), reused 0 (delta 0)
30+
To https://gitcafe.com/ezlippi/ezlippi.git
31+
f0d0296..51611d7 master -> gitcafe-pages
32+
{% endhighlight %}
33+
34+
* gitcafe绑定自己的域名
35+
36+
1. 点击项目的右上角的 项目配置
37+
2. 在项目的 基础设置 中配置项目主页
38+
3. 在 page服务 中添加自己的域名,比如我这里是[coolshell.info](coolshell.info)[www.coolshell.info](www.coolshell.info).
39+
40+
* DNS的配置中增加一项 CNAME.
41+
42+
我使用 dnspod 这个提供商来管理DNS.CNAME一般可以按解析路线或者网络类型来单独配置,网络类型选择国内或者联通,设置之后等待一段时间百度的抓取就 恢复正常了,如下图所示:
43+
44+
![](/images/dnspod.png)
45+
46+

0 commit comments

Comments
 (0)