<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[Snooda]]></title> 
<link>http://www.snooda.com/index</link> 
<description><![CDATA[Snooda's Blog]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[Snooda]]></copyright>
<item>
<link>http://www.snooda.com/read/</link>
<title><![CDATA[为博客nginx日志添加请求域名打印（host字段）及添加其他域跳转到主域]]></title> 
<author>snooda &lt;admin@snooda.com&gt;</author>
<category><![CDATA[nginx]]></category>
<pubDate>Thu, 17 May 2012 09:40:24 +0000</pubDate> 
<guid>http://www.snooda.com/read/</guid> 
<description>
<![CDATA[ 
	&nbsp;&nbsp;&nbsp;&nbsp;前几天百度快照和流量都恢复了，心情很好，但今天看收录时突然发现迁移前服务器绑定的那个临时域名居然也在收录之列，这个不是一个好的现象，因为如果爬虫同时对两个域名同时抓取，会得到相同的内容，对于重复内容是很不利于收录的。查了下快照，发现百度依旧动作很慢，收录只有一页，还是迁移前的那个测试页，google则全都收录了，怪不得迁移时google非常活跃，现在回想应该不是爬主域名，很可能是发现那个临时域名指向的站点大更新，在爬那个。<br/><br/>&nbsp;&nbsp; 纠结的是nginx默认配置居然不打印请求的host域名，无法考证之前爬虫爬取情况，亡羊补牢，幸亏nginx默认留空了日志第二个字段，打印的是“-”，正好用来打印域名，将-修改为$host，重启后就打印了。<br/><br/><br/>&nbsp;&nbsp; 对于已经收录的临时域名，需要将流量都导入到主域，在nginx里配置了一下301跳转：<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;if ($host = 'tmpdomain.com' )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#123;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rewrite&nbsp;&nbsp;^/(.*)$&nbsp;&nbsp;http://maindomain.com/$1&nbsp;&nbsp;permanent;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125;<br/><br/><br/><br/>&nbsp;&nbsp; ok<br/>Tags - <a href="http://www.snooda.com/tags/nginx/" rel="tag">nginx</a> , <a href="http://www.snooda.com/tags/%25E6%2597%25A5%25E5%25BF%2597/" rel="tag">日志</a>
]]>
</description>
</item><item>
<link>http://www.snooda.com/read/#blogcomment</link>
<title><![CDATA[[评论] 为博客nginx日志添加请求域名打印（host字段）及添加其他域跳转到主域]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.snooda.com/read/#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>