Linux/Nginx怎么样查看搜索引擎蜘蛛爬虫的行径
<div style="color: black; text-align: left; margin-bottom: 10px;">
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">做好网站SEO优化的<span style="color: black;">第1</span>步<span style="color: black;">便是</span><span style="color: black;">首要</span>让蜘蛛爬虫经常来你的网站进行<span style="color: black;">光临</span>,下面的Linux命令<span style="color: black;">能够</span>让你清楚的<span style="color: black;">晓得</span>蜘蛛的爬行<span style="color: black;">状况</span>。下面<span style="color: black;">咱们</span>针对nginx服务器进行分析,日志文件所在目录:</p>/usr/local/nginx/logs/access.log,access.log这个文件记录的应该是<span style="color: black;">近期</span>一天的日志情况,<span style="color: black;">首要</span>请<span style="color: black;">瞧瞧</span>日志<span style="color: black;">体积</span>,<span style="color: black;">倘若</span>很大(超过50MB)<span style="color: black;">意见</span>别用这些命令分析,<span style="color: black;">由于</span>这些命令很消耗CPU,<span style="color: black;">或</span>更新下来放到分析机上执行,<span style="color: black;">以避免</span>影响网站的速度。
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">Linux shell命令</strong></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">1. 百度蜘蛛爬行的次数</strong></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">cat access.log | grep Baiduspider | wc</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">最左面的数值<span style="color: black;">表示</span>的<span style="color: black;">便是</span>爬行次数。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">2. 百度蜘蛛的<span style="color: black;">仔细</span>记录(Ctrl C<span style="color: black;">能够</span>终止)</strong></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">cat access.log | grep Baiduspider</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">亦</span><span style="color: black;">能够</span>用下面的命令:</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">cat access.log | grep Baiduspider | tail -n 10</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">cat access.log | grep Baiduspider | head -n 10</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">只看最后10条或最前10条,这用就能<span style="color: black;">晓得</span>这个日志文件的<span style="color: black;">起始</span>记录的时间和日期。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">3. 百度蜘蛛抓取首页的<span style="color: black;">仔细</span>记录</strong></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">cat access.log | grep Baiduspider | grep “GET / HTTP”</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">百度蜘蛛<span style="color: black;">好似</span>对首页非常热爱<span style="color: black;">每一个</span>钟头都来<span style="color: black;">光临</span>,而谷歌和雅虎蜘蛛更喜欢内页。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">4. 百度蜘蛛派性记录时间点分布</strong></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">cat access.log | grep “Baiduspider ” | awk ‘{print $4}</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">5. 百度蜘蛛爬行页面按次数降序列表</strong></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">cat access.log | grep “Baiduspider ” | awk ‘{print $7} | sort | uniq -c | sort -r</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">文中的Baiduspider 改成Googlebot都<span style="color: black;">能够</span>查看谷歌的数据,鉴于大陆的特殊性,<span style="color: black;">大众</span>应该对百度的log更为关注。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">附:(Mediapartners-Google)Google adsense蜘蛛的<span style="color: black;">仔细</span>爬行记录</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">cat access.log | grep Mediapartners</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">Mediapartners-Google是什么呢?Google adsense<span style="color: black;">宣传</span>之<span style="color: black;">因此</span>能与内容<span style="color: black;">关联</span>,<span style="color: black;">由于</span><span style="color: black;">每一个</span><span style="color: black;">包括</span>着adsense的<span style="color: black;">宣传</span>被<span style="color: black;">拜访</span>后,<span style="color: black;">火速</span>就有个Mediapartners-Google蜘蛛来到这个页面,<span style="color: black;">因此</span>几分钟后再刷新就能<span style="color: black;">表示</span><span style="color: black;">关联</span>性<span style="color: black;">宣传</span>了,真厉害啊!</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">ps</strong>:linux下nginx<span style="color: black;">怎样</span>启用网站日志,查看蜘蛛爬虫</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">默认的路径是你安装时候指定的</p>
</div>
交流如星光璀璨,点亮思想夜空。 回顾历史,我们不难发现:无数先辈用鲜血和生命铺就了中华民族复兴的康庄大道。 你的见解真是独到,让我受益匪浅。 网站建设seio论坛http://www.fok120.com/
页:
[1]