<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>刀刀 &#124; Python,Nginx,Linux,FreeBSD</title>
	<atom:link href="http://tech.foolpig.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://tech.foolpig.com</link>
	<description></description>
	<pubDate>Thu, 02 Sep 2010 02:19:24 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>让vim显示空格,及tab字符 vim 多行注释</title>
		<link>http://tech.foolpig.com/2010/09/02/vim-tab/</link>
		<comments>http://tech.foolpig.com/2010/09/02/vim-tab/#comments</comments>
		<pubDate>Thu, 02 Sep 2010 02:17:11 +0000</pubDate>
		<dc:creator>foolpig</dc:creator>
		
		<category><![CDATA[东写西读]]></category>

		<category><![CDATA[tab]]></category>

		<category><![CDATA[vim]]></category>

		<category><![CDATA[注释]]></category>

		<guid isPermaLink="false">http://tech.foolpig.com/2010/09/02/vimtab%e6%b3%a8%e9%87%8a/</guid>
		<description><![CDATA[1、显示 TAB 键 
文件中有 TAB 键的时候，你是看不见的。要把它显示出来： 
:set list 
现在 TAB 键显示为 ^I，而 $显示在每行的结尾，以便你能找到可能会被你忽略的空白字符在哪里。   这样做的... ]]></description>
			<content:encoded><![CDATA[<p>1、显示 TAB 键 </p>
<p>文件中有 TAB 键的时候，你是看不见的。要把它显示出来： </p>
<p>:set list </p>
<p>现在 TAB 键显示为 ^I，而 $显示在每行的结尾，以便你能找到可能会被你忽略的空白字符在哪里。   <br />这样做的一个缺点是在有很多 TAB 的时候看起来很丑。如果你使用一个有颜色的终端，或者使用 GUI 模式，Vim 可以用高亮显示空格和TAB。     <br />使用 &#8216;listchars&#8217; 选项： </p>
<p>:set listchars=tab:&gt;-,trail:- </p>
<p>现在，TAB会被显示成 &quot;&gt;&#8212;&quot; 而行尾多余的空白字符显示成 &quot;-&quot;。看起来好多了，是吧？ </p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; </p>
<p>2、让vim显示行尾的空格 </p>
<p>fedora 9系统下   <br />在/etc/vimrc文件添加如下两行    <br />highlight WhitespaceEOL ctermbg=red guibg=red    <br />match WhitespaceEOL /\s\+$/ </p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; </p>
<p>3、vim 的搜索及替换 </p>
<p>搜索替换的范围。如果没有指定范围，则只在当前行进行搜索替换。 </p>
<p>在所有行进行搜索替换。范围符号%表示在所有行进行搜索替换。:%s/from/to/就是在全文查找from并替换为to。   <br />在指定的行上进行搜索替换。:1,50s/from/to/表示在第1行和第50行之间（包括1和50行）进行搜索和替换。:45s/from/to/表示仅仅在第45行进行搜索和替换。而&quot;1,$&quot;行号范围和“%“是等价的。 </p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; </p>
<p>4、Vim多行缩进技巧 </p>
<p>关键字: vim indent </p>
<p>按v进入visual状态，选择多行，用&gt;或&lt;缩进或缩出 </p>
<p>通常根据语言特征使用自动缩进排版：在命令状态下对当前行用== （连按=两次）, 或对多行用n==（n是自然数）表示自动缩进从当前行起的下面n行。你可以试试把代码缩进任意打乱再用n==排版，相当于一般IDE里的code format。使用gg=G可对整篇代码进行排版。 </p>
<p>vim 多行注释 </p>
<p>:20,30 s/^/#/g 第20到30行用 # 注释掉。 </p>
<p>:20,30 s/^#//g 取消注释 </p>
<p>:4,10 s/^[^I ]\+// 去掉行首的空白字符 </p>
<p>用 . 表示当前行。 </p>
<p>:.,30 s/^/#/g </p>
<p>可以看到 vim 命令针对当前行，在前面加个范围就可以针对多行。 </p>
<p>:co 12 </p>
<p>把当前行 copy 到行 12 的地方。</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.foolpig.com/2010/09/02/vim-tab/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Python 2.6+Django 1.2.1 + Nginx</title>
		<link>http://tech.foolpig.com/2010/08/30/python-django-nginx/</link>
		<comments>http://tech.foolpig.com/2010/08/30/python-django-nginx/#comments</comments>
		<pubDate>Mon, 30 Aug 2010 07:18:36 +0000</pubDate>
		<dc:creator>foolpig</dc:creator>
		
		<category><![CDATA[东写西读]]></category>

		<guid isPermaLink="false">http://tech.foolpig.com/2010/08/30/python-26django-121-nginx/</guid>
		<description><![CDATA[&#160;&#160; &#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; Python 2.6.5 + Django 1.2.1 + Nginx Installation &#038;&#038; Configuration  &#160;&#160; &#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160;&#160;&#160; &#160;&#... ]]></description>
			<content:encoded><![CDATA[<p>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Python 2.6.5 + Django 1.2.1 + Nginx Installation &#038;&#038; Configuration</br>  &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; fastcgi+django,fastcgi+php </br>   </br>  </br>   一、install </br>    ## 万恶的XXX，封掉了python下的所有目录，首页上的download链接是打不开的，不过可以到其他的链接下载 ## </br>  ## 1、http://ftp.python.org/ftp/python/2.6.5/ </br>  ## 2、http://www.python.org/ftp/python/ </br> </br>  </br>  1. Python 2.6.5 </br> 1) install </br></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>ftp.python.org<span style="color: #000000; font-weight: bold;">/</span>ftp<span style="color: #000000; font-weight: bold;">/</span>python<span style="color: #000000; font-weight: bold;">/</span>2.6.5<span style="color: #000000; font-weight: bold;">/</span>Python-2.6.5.tgz
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf Python-2.6.5.tgz
<span style="color: #7a0874; font-weight: bold;">cd</span> Python-2.6.5
.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>python26
<span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>python26<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>python2.6 <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>python26</pre></div></div>

<p>## add the /opt/python26/bin to the PATH </br><br />
vi /etc/profile </br> </p>
<p>########################### </br><br />
PATH=&quot;$PATH:/opt/mysql/bin:/opt/python/bin:/opt/nginx/sbin:/opt/python26/bin&quot;;export PATH </br><br />
########################### </br><br />
2)test</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>devel photo_uw<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># python26</span>
Python 2.6.5 <span style="color: #7a0874; font-weight: bold;">&#40;</span>r265:<span style="color: #000000;">79063</span>, Jul <span style="color: #000000;">20</span> <span style="color: #000000;">2010</span>, <span style="color: #000000;">10</span>:<span style="color: #000000;">39</span>:03<span style="color: #7a0874; font-weight: bold;">&#41;</span> 
<span style="color: #7a0874; font-weight: bold;">&#91;</span>GCC 4.1.2 <span style="color: #000000;">20080704</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>Red Hat 4.1.2-<span style="color: #000000;">46</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> on linux2
Type <span style="color: #ff0000;">&quot;help&quot;</span>, <span style="color: #ff0000;">&quot;copyright&quot;</span>, <span style="color: #ff0000;">&quot;credits&quot;</span> or <span style="color: #ff0000;">&quot;license&quot;</span> <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #c20cb9; font-weight: bold;">more</span> information.
<span style="color: #000000; font-weight: bold;">&gt;&gt;&gt;</span></pre></div></div>

<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- </br><br />
2. PIL </br><br />
1) install</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>effbot.org<span style="color: #000000; font-weight: bold;">/</span>downloads<span style="color: #000000; font-weight: bold;">/</span>Imaging-1.1.7.tar.gz
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf Imaging-1.1.7.tar.tar
<span style="color: #7a0874; font-weight: bold;">cd</span> Imaging-1.1.7
python26 setup.py build_ext <span style="color: #660033;">-i</span>
python26 setup.py <span style="color: #c20cb9; font-weight: bold;">install</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> ..</pre></div></div>

<p>2) test</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>devel photo_uw<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># python26</span>
Python 2.6.5 <span style="color: #7a0874; font-weight: bold;">&#40;</span>r265:<span style="color: #000000;">79063</span>, Jul <span style="color: #000000;">20</span> <span style="color: #000000;">2010</span>, <span style="color: #000000;">10</span>:<span style="color: #000000;">39</span>:03<span style="color: #7a0874; font-weight: bold;">&#41;</span> 
<span style="color: #7a0874; font-weight: bold;">&#91;</span>GCC 4.1.2 <span style="color: #000000;">20080704</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>Red Hat 4.1.2-<span style="color: #000000;">46</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> on linux2
Type <span style="color: #ff0000;">&quot;help&quot;</span>, <span style="color: #ff0000;">&quot;copyright&quot;</span>, <span style="color: #ff0000;">&quot;credits&quot;</span> or <span style="color: #ff0000;">&quot;license&quot;</span> <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #c20cb9; font-weight: bold;">more</span> information.
<span style="color: #000000; font-weight: bold;">&gt;&gt;&gt;</span> import Image
<span style="color: #000000; font-weight: bold;">&gt;&gt;&gt;</span></pre></div></div>

<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- </br><br />
3. setuptools</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>pypi.python.org<span style="color: #000000; font-weight: bold;">/</span>packages<span style="color: #000000; font-weight: bold;">/</span>source<span style="color: #000000; font-weight: bold;">/</span>s<span style="color: #000000; font-weight: bold;">/</span>setuptools<span style="color: #000000; font-weight: bold;">/</span>setuptools-0.6c11.tar.gz
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf setuptools-0.6c11.tar.gz
<span style="color: #7a0874; font-weight: bold;">cd</span> setuptools-0.6c11
python26 setup.py <span style="color: #c20cb9; font-weight: bold;">install</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> ..</pre></div></div>

<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- </br><br />
4. flup</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.saddi.com<span style="color: #000000; font-weight: bold;">/</span>software<span style="color: #000000; font-weight: bold;">/</span>flup<span style="color: #000000; font-weight: bold;">/</span>dist<span style="color: #000000; font-weight: bold;">/</span>flup-1.0.2.tar.gz
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf flup-1.0.2.tar.gz
<span style="color: #7a0874; font-weight: bold;">cd</span> flup-1.0.2
python26 setup.py <span style="color: #c20cb9; font-weight: bold;">install</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> ..</pre></div></div>

<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- </br><br />
5. MySQL-python </br><br />
1) install</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>nchc.dl.sourceforge.net<span style="color: #000000; font-weight: bold;">/</span>project<span style="color: #000000; font-weight: bold;">/</span>mysql-python<span style="color: #000000; font-weight: bold;">/</span>mysql-python<span style="color: #000000; font-weight: bold;">/</span>1.2.3<span style="color: #000000; font-weight: bold;">/</span>MySQL-python-1.2.3.tar.gz
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf MySQL-python-1.2.3c1.tar.gz
<span style="color: #7a0874; font-weight: bold;">cd</span> MySQL-python-1.2.3c1
python26 setup.py build
python26 setup.py <span style="color: #c20cb9; font-weight: bold;">install</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> ..</pre></div></div>

<p>2) test</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>devel photo_uw<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># python26</span>
Python 2.6.5 <span style="color: #7a0874; font-weight: bold;">&#40;</span>r265:<span style="color: #000000;">79063</span>, Jul <span style="color: #000000;">20</span> <span style="color: #000000;">2010</span>, <span style="color: #000000;">10</span>:<span style="color: #000000;">39</span>:03<span style="color: #7a0874; font-weight: bold;">&#41;</span> 
<span style="color: #7a0874; font-weight: bold;">&#91;</span>GCC 4.1.2 <span style="color: #000000;">20080704</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>Red Hat 4.1.2-<span style="color: #000000;">46</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> on linux2
Type <span style="color: #ff0000;">&quot;help&quot;</span>, <span style="color: #ff0000;">&quot;copyright&quot;</span>, <span style="color: #ff0000;">&quot;credits&quot;</span> or <span style="color: #ff0000;">&quot;license&quot;</span> <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #c20cb9; font-weight: bold;">more</span> information.
<span style="color: #000000; font-weight: bold;">&gt;&gt;&gt;</span> import MySQLdb
<span style="color: #000000; font-weight: bold;">&gt;&gt;&gt;</span></pre></div></div>

<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- </br><br />
6 Django 1.2.1 </br><br />
1) install</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>media.djangoproject.com<span style="color: #000000; font-weight: bold;">/</span>releases<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1.2</span><span style="color: #000000; font-weight: bold;">/</span>Django-1.2.1.tar.gz
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf Django-1.2.1.tar.gz
<span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-R</span> Django-1.2.1 <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>python26
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>python26<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>python2.6<span style="color: #000000; font-weight: bold;">/</span>site-packages<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>python26<span style="color: #000000; font-weight: bold;">/</span>Django-1.2.1<span style="color: #000000; font-weight: bold;">/</span>django django</pre></div></div>

<p>or</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> Django-1.2.1
python26 setup.py <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>2) test</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>devel photo_uw<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># python26</span>
Python 2.6.5 <span style="color: #7a0874; font-weight: bold;">&#40;</span>r265:<span style="color: #000000;">79063</span>, Jul <span style="color: #000000;">20</span> <span style="color: #000000;">2010</span>, <span style="color: #000000;">10</span>:<span style="color: #000000;">39</span>:03<span style="color: #7a0874; font-weight: bold;">&#41;</span> 
<span style="color: #7a0874; font-weight: bold;">&#91;</span>GCC 4.1.2 <span style="color: #000000;">20080704</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>Red Hat 4.1.2-<span style="color: #000000;">46</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> on linux2
Type <span style="color: #ff0000;">&quot;help&quot;</span>, <span style="color: #ff0000;">&quot;copyright&quot;</span>, <span style="color: #ff0000;">&quot;credits&quot;</span> or <span style="color: #ff0000;">&quot;license&quot;</span> <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #c20cb9; font-weight: bold;">more</span> information.
<span style="color: #000000; font-weight: bold;">&gt;&gt;&gt;</span> import django
<span style="color: #000000; font-weight: bold;">&gt;&gt;&gt;</span> django.get_version<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #ff0000;">'1.2.1'</span></pre></div></div>

<p>7. django-treebeard </br><br />
1) install</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>pypi.python.org<span style="color: #000000; font-weight: bold;">/</span>packages<span style="color: #000000; font-weight: bold;">/</span>source<span style="color: #000000; font-weight: bold;">/</span>d<span style="color: #000000; font-weight: bold;">/</span>django-treebeard<span style="color: #000000; font-weight: bold;">/</span>django-treebeard-1.61.tar.gz
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf django-treebeard-1.61.tar.gz
<span style="color: #7a0874; font-weight: bold;">cd</span> django-treebeard-<span style="color: #000000;">1.61</span>
python26 setup.py <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>2) test</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>devel photo_uw<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># python26</span>
Python 2.6.5 <span style="color: #7a0874; font-weight: bold;">&#40;</span>r265:<span style="color: #000000;">79063</span>, Jul <span style="color: #000000;">20</span> <span style="color: #000000;">2010</span>, <span style="color: #000000;">10</span>:<span style="color: #000000;">39</span>:03<span style="color: #7a0874; font-weight: bold;">&#41;</span> 
<span style="color: #7a0874; font-weight: bold;">&#91;</span>GCC 4.1.2 <span style="color: #000000;">20080704</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>Red Hat 4.1.2-<span style="color: #000000;">46</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> on linux2
Type <span style="color: #ff0000;">&quot;help&quot;</span>, <span style="color: #ff0000;">&quot;copyright&quot;</span>, <span style="color: #ff0000;">&quot;credits&quot;</span> or <span style="color: #ff0000;">&quot;license&quot;</span> <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #c20cb9; font-weight: bold;">more</span> information.
<span style="color: #000000; font-weight: bold;">&gt;&gt;&gt;</span> import treebeard
<span style="color: #000000; font-weight: bold;">&gt;&gt;&gt;</span></pre></div></div>

<p>二. configure </br><br />
1) nginx</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>vhosts
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">vi</span> vhost-www_tech.conf
&nbsp;
<span style="color: #660033;">--------------------------------------------------------------------</span>
	upstream backend_www_tech <span style="color: #7a0874; font-weight: bold;">&#123;</span>
		<span style="color: #666666; font-style: italic;">#server unix:/var/run/fcgi/www/www_tech.sock;</span>
		server unix:<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>fcgi<span style="color: #000000; font-weight: bold;">/</span>www_tech.sock;
	<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
	server <span style="color: #7a0874; font-weight: bold;">&#123;</span>
		listen       192.168.0.250;
		server_name  192.168.0.250;
&nbsp;
		<span style="color: #666666; font-style: italic;">#charset gb2312;</span>
&nbsp;
		access_log  <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>www_tech<span style="color: #000000; font-weight: bold;">/</span>www_tech_access_log combined;
		error_log   <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>www_tech<span style="color: #000000; font-weight: bold;">/</span>www_tech_error_log notice;
&nbsp;
		location <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
			root        <span style="color: #000000; font-weight: bold;">/</span>infoware<span style="color: #000000; font-weight: bold;">/</span>www_tech<span style="color: #000000; font-weight: bold;">/</span>web;
			<span style="color: #666666; font-style: italic;">#allow  all;</span>
			<span style="color: #666666; font-style: italic;">#fastcgi_pass    backend_dorm;</span>
			fastcgi_pass    backend_www_tech;
			fastcgi_param   PATH_INFO       <span style="color: #007800;">$fastcgi_script_name</span>;
			fastcgi_param   REMOTE_ADDR     <span style="color: #007800;">$remote_addr</span>;
			fastcgi_pass_header             Authorization;
			include         fastcgi_params_django;
&nbsp;
		<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
		location <span style="color: #000000; font-weight: bold;">/</span>static <span style="color: #7a0874; font-weight: bold;">&#123;</span>
			root            <span style="color: #000000; font-weight: bold;">/</span>infoware<span style="color: #000000; font-weight: bold;">/</span>www_tech<span style="color: #000000; font-weight: bold;">/</span>web;
		<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
		error_page  <span style="color: #000000;">404</span>     http:<span style="color: #000000; font-weight: bold;">//</span>192.168.0.250<span style="color: #000000; font-weight: bold;">/</span>static<span style="color: #000000; font-weight: bold;">/</span>error404.htm;
	<span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #660033;">--------------------------------------------------------------------</span></pre></div></div>

<p>#################################################################### </br><br />
## 这里不能使用nginx默认的fastcgi_params，测试的时候发现所有的页面都会跳转到首页，而且也不报错</br><br />
## 貌似是SCRIPT_NAME所引起的问题，而Django好像使用的是PATH_INFO，为了避免和其他的fcgi冲突，所以新建一个django专用的fastcgi_params_django</br><br />
## Python2.4 + Django 0.96 版本不需要，因为Django 0.96 还不支持SCRIPT_NAME</br><br />
## 可以查看django的django\core\handlers目录下的modpython.py 文件 </br></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>fastcgi_params_django
&nbsp;
fastcgi_param  PATH_INFO          <span style="color: #007800;">$fastcgi_script_name</span>;
fastcgi_param  REQUEST_METHOD     <span style="color: #007800;">$request_method</span>;
fastcgi_param  QUERY_STRING       <span style="color: #007800;">$query_string</span>;
fastcgi_param  CONTENT_TYPE       <span style="color: #007800;">$content_type</span>;
fastcgi_param  CONTENT_LENGTH     <span style="color: #007800;">$content_length</span>;
fastcgi_param  SERVER_PROTOCOL    <span style="color: #007800;">$server_protocol</span>;
<span style="color: #666666; font-style: italic;"># fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;</span>
<span style="color: #666666; font-style: italic;"># fastcgi_param  REQUEST_URI        $request_uri;</span>
<span style="color: #666666; font-style: italic;"># fastcgi_param  DOCUMENT_URI       $document_uri;</span>
<span style="color: #666666; font-style: italic;"># fastcgi_param  DOCUMENT_ROOT      $document_root;</span>
fastcgi_param  GATEWAY_INTERFACE  CGI<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1.1</span>;
fastcgi_param  SERVER_SOFTWARE    nginx<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$nginx_version</span>;
fastcgi_param  REMOTE_ADDR        <span style="color: #007800;">$remote_addr</span>;
fastcgi_param  REMOTE_PORT        <span style="color: #007800;">$remote_port</span>;
fastcgi_param  SERVER_ADDR        <span style="color: #007800;">$server_addr</span>;
fastcgi_param  SERVER_PORT        <span style="color: #007800;">$server_port</span>;
fastcgi_param  SERVER_NAME        <span style="color: #007800;">$server_name</span>;</pre></div></div>

<p>2) fcgi</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>infoware<span style="color: #000000; font-weight: bold;">/</span>_conf<span style="color: #000000; font-weight: bold;">/</span>www_tech<span style="color: #000000; font-weight: bold;">/</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">vi</span> start_www_tech.sh
<span style="color: #660033;">------------------------------------------------------------------</span>
<span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #666666; font-style: italic;">## start_www_tech.sh: start www_tech app in django fcgi mode</span>
<span style="color: #666666; font-style: italic;">## ljzhou, 2010.08.26</span>
&nbsp;
<span style="color: #666666; font-style: italic;">## TODO</span>
<span style="color: #666666; font-style: italic;">#  - executed under deamontools(in method=thread mode), to get</span>
<span style="color: #666666; font-style: italic;">#    (1) controled env (2) 'web' uid (3) monitored process</span>
<span style="color: #666666; font-style: italic;">#  - dormctl.sh script(nginx+django?), just as apachectl</span>
&nbsp;
<span style="color: #007800;">APP_DIR</span>=<span style="color: #ff0000;">&quot;/infoware/www_tech/web&quot;</span>
<span style="color: #007800;">CFG_DIR</span>=<span style="color: #ff0000;">&quot;/infoware/_conf/www_tech&quot;</span>
&nbsp;
<span style="color: #007800;">PYTHON</span>=<span style="color: #ff0000;">&quot;/usr/bin/python26&quot;</span>
<span style="color: #007800;">DJANGO_ADMIN</span>=<span style="color: #ff0000;">&quot;/opt/python26/lib/python2.6/site-packages/django/bin/django-admin.py&quot;</span>
<span style="color: #666666; font-style: italic;">#PYTHON=&quot;/opt/python/bin/python2&quot;</span>
<span style="color: #666666; font-style: italic;">#DJANGO_ADMIN=&quot;/usr/lib/python2.4/site-packages/django/bin/django-admin.py&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">############### no config below this line ##################</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PYTHONPATH</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$PYTHONPATH</span>:<span style="color: #007800;">$CFG_DIR</span>&quot;</span>
<span style="color: #666666; font-style: italic;"># mysettings.py in $CFG_DIR</span>
<span style="color: #666666; font-style: italic;">#export DJANGO_SETTINGS_MODULE=mysettings</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">DJANGO_SETTINGS_MODULE</span>=settings
&nbsp;
<span style="color: #7a0874; font-weight: bold;">umask</span> 027
&nbsp;
<span style="color: #666666; font-style: italic;">## -- debug, for dev</span>
<span style="color: #666666; font-style: italic;">#/usr/bin/python2 django-admin.py --pythonpath='/infoware/dorm_django/web' runserver 192.168.0.230:8080</span>
<span style="color: #666666; font-style: italic;">## -- debug, for server</span>
<span style="color: #666666; font-style: italic;">#/usr/bin/python2 /opt/python/lib/python2.4/site-packages/django/bin/django-admin.py --pythonpath='/infoware/dorm/web' runserver 202.189.82.138:8000</span>
<span style="color: #666666; font-style: italic;">## -- server: called from spawn-fcgi</span>
<span style="color: #666666; font-style: italic;">#/usr/bin/python2 /opt/python/lib/python2.4/site-packages/django/bin/django-admin.py --pythonpath='/infoware/dorm/web' runfcgi method=thread</span>
&nbsp;
<span style="color: #666666; font-style: italic;">## server: self daemonized, total num=20 with 10 threads each</span>
<span style="color: #666666; font-style: italic;">## Help message:   help</span>
<span style="color: #666666; font-style: italic;">## TCP socket  :   host=... port=...</span>
<span style="color: #007800;">PIDFILE</span>=<span style="color: #ff0000;">&quot;/var/run/fcgi/www_tech.pid&quot;</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$PIDFILE</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #660033;">--</span> <span style="color: #007800;">$PIDFILE</span><span style="color: #000000; font-weight: bold;">`</span>
    <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-f</span> <span style="color: #660033;">--</span> <span style="color: #007800;">$PIDFILE</span>
    <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">3</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #007800;">$PYTHON</span> <span style="color: #007800;">$DJANGO_ADMIN</span> \
    runfcgi <span style="color: #007800;">daemonize</span>=<span style="color: #c20cb9; font-weight: bold;">true</span> <span style="color: #007800;">method</span>=prefork \
    <span style="color: #007800;">maxspare</span>=<span style="color: #000000;">5</span> <span style="color: #007800;">minspare</span>=<span style="color: #000000;">2</span> <span style="color: #007800;">maxchildren</span>=<span style="color: #000000;">10</span> <span style="color: #007800;">maxrequests</span>=<span style="color: #000000;">500</span> \
    <span style="color: #007800;">socket</span>=<span style="color: #ff0000;">&quot;/var/run/fcgi/www_tech.sock&quot;</span> <span style="color: #007800;">pidfile</span>=<span style="color: #007800;">$PIDFILE</span> \
    <span style="color: #007800;"><span style="color: #7a0874; font-weight: bold;">umask</span></span>=000 <span style="color: #007800;">debug</span>=<span style="color: #c20cb9; font-weight: bold;">true</span> \
    <span style="color: #660033;">--pythonpath</span>=<span style="color: #007800;">$APP_DIR</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># EOF: start_www_tech.sh</span>
&nbsp;
<span style="color: #660033;">------------------------------------------------------------------</span>
stop script like this , only Remark those:
&nbsp;
<span style="color: #666666; font-style: italic;">#$PYTHON $DJANGO_ADMIN \</span>
<span style="color: #666666; font-style: italic;">#    runfcgi daemonize=true method=prefork \</span>
<span style="color: #666666; font-style: italic;">#    maxspare=5 minspare=2 maxchildren=10 maxrequests=500 \</span>
<span style="color: #666666; font-style: italic;">#    socket=&amp;&quot;/var/run/fcgi/www_tech.sock&quot; pidfile=$PIDFILE \</span>
<span style="color: #666666; font-style: italic;">#    umask=000 debug=true \</span>
<span style="color: #666666; font-style: italic;">#    --pythonpath=$APP_DIR</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://tech.foolpig.com/2010/08/30/python-django-nginx/feed/</wfw:commentRss>
		</item>
		<item>
		<title>升级nginx，查看已经安装的模块，并隐藏或者修改版本号</title>
		<link>http://tech.foolpig.com/2010/06/01/nginx-version/</link>
		<comments>http://tech.foolpig.com/2010/06/01/nginx-version/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 07:18:32 +0000</pubDate>
		<dc:creator>foolpig</dc:creator>
		
		<category><![CDATA[东写西读]]></category>

		<category><![CDATA[nginx]]></category>

		<category><![CDATA[version]]></category>

		<guid isPermaLink="false">http://tech.foolpig.com/2010/06/01/nginx-version/</guid>
		<description><![CDATA[升级，查看已经安装的模块

&#91;root@mail ~&#93;# /opt/nginx/sbin/nginx -V
nginx version: nginx/0.5.34
built by gcc 3.4.6 20060404 &#40;Red Hat 3.4.6-3&#41;
configure arguments: --prefix=/opt/nginx --sbin-path=/opt/nginx/sbin/nginx --conf-path... ]]></description>
			<content:encoded><![CDATA[<p>升级，查看已经安装的模块</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>mail ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># /opt/nginx/sbin/nginx -V</span>
nginx version: nginx<span style="color: #000000; font-weight: bold;">/</span>0.5.34
built by <span style="color: #c20cb9; font-weight: bold;">gcc</span> 3.4.6 <span style="color: #000000;">20060404</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>Red Hat 3.4.6-<span style="color: #000000;">3</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
configure arguments: <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>nginx <span style="color: #660033;">--sbin-path</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>nginx <span style="color: #660033;">--conf-path</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>nginx.conf <span style="color: #660033;">--pid-path</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>nginx.pid 
<span style="color: #660033;">--error-log-path</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>error.log <span style="color: #660033;">--http-log-path</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>access.log <span style="color: #660033;">--http-proxy-temp-path</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>temp<span style="color: #000000; font-weight: bold;">/</span>proxy 
<span style="color: #660033;">--http-fastcgi-temp-path</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>temp<span style="color: #000000; font-weight: bold;">/</span>fcgi <span style="color: #660033;">--lock-path</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>nginx.lock --with-http_ssl_module --with-http_sub_module 
--with-http_stub_status_module <span style="color: #660033;">--with-debug</span></pre></div></div>

<p>修改版本号：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>mail nginx-0.8.39<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># vi src/core/nginx.h</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#define nginx_version         8039</span>
<span style="color: #666666; font-style: italic;">#define NGINX_VERSION      &quot;0.8.39&quot;</span>
<span style="color: #666666; font-style: italic;">#define NGINX_VER          &quot;nginx/&quot; NGINX_VERSION</span></pre></div></div>

<p>改成：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#define nginx_version         8039</span>
<span style="color: #666666; font-style: italic;">#define NGINX_VERSION      &quot;0.0.0&quot;</span>
<span style="color: #666666; font-style: italic;">#define NGINX_VER          &quot;netbig/&quot; NGINX_VERSION</span></pre></div></div>

<p>然后重新编译：<br />
## 增加http_gzip和http_flv模块</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>nginx \
<span style="color: #660033;">--sbin-path</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>nginx \
<span style="color: #660033;">--conf-path</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>nginx.conf \
<span style="color: #660033;">--pid-path</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>nginx.pid \
<span style="color: #660033;">--error-log-path</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>error.log \
<span style="color: #660033;">--http-log-path</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>access.log \
<span style="color: #660033;">--http-proxy-temp-path</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>temp<span style="color: #000000; font-weight: bold;">/</span>proxy \
<span style="color: #660033;">--http-fastcgi-temp-path</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>temp<span style="color: #000000; font-weight: bold;">/</span>fcgi \
<span style="color: #660033;">--lock-path</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>nginx.lock \
--with-http_ssl_module \
--with-http_sub_module \
--with-http_gzip_static_module \
--with-http_stub_status_module \
--with-http_flv_module \
<span style="color: #660033;">--with-debug</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>重新启动nginx</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>mail nginx-0.8.39<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># nginxctl stop</span>
Shutting down nginx:
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>mail vhosts<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># nginxctl start</span>
Starting nginx: success nginx</pre></div></div>

<p>## 注：这个nginxctl是自己写的脚本</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>mail vhosts<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># /opt/nginx/sbin/nginx -V</span>
nginx version: netbig<span style="color: #000000; font-weight: bold;">/</span>0.0.0
built by <span style="color: #c20cb9; font-weight: bold;">gcc</span> 3.4.6 <span style="color: #000000;">20060404</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>Red Hat 3.4.6-<span style="color: #000000;">3</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
TLS SNI support disabled
configure arguments: <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>nginx <span style="color: #660033;">--sbin-path</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>nginx <span style="color: #660033;">--conf-path</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>nginx.conf <span style="color: #660033;">--pid-path</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>nginx.pid 
<span style="color: #660033;">--error-log-path</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>error.log <span style="color: #660033;">--http-log-path</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>access.log <span style="color: #660033;">--http-proxy-temp-path</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>temp<span style="color: #000000; font-weight: bold;">/</span>proxy 
<span style="color: #660033;">--http-fastcgi-temp-path</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>temp<span style="color: #000000; font-weight: bold;">/</span>fcgi <span style="color: #660033;">--lock-path</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>nginx.lock --with-http_ssl_module --with-http_sub_module 
--with-http_gzip_static_module --with-http_stub_status_module --with-http_flv_module <span style="color: #660033;">--with-debug</span></pre></div></div>

<p>查看 response header</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>mail vhosts<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># curl -I http://www.tech.zhangben.com</span>
HTTP<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1.1</span> <span style="color: #000000;">200</span> OK
Server: netbig<span style="color: #000000; font-weight: bold;">/</span>0.0.0
Date: Tue, 01 Jun <span style="color: #000000;">2010</span> 07:09:<span style="color: #000000;">11</span> GMT
Content-Type: text<span style="color: #000000; font-weight: bold;">/</span>html; <span style="color: #007800;">charset</span>=utf-<span style="color: #000000;">8</span>
Connection: keep-alive
Vary: Cookie</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://tech.foolpig.com/2010/06/01/nginx-version/feed/</wfw:commentRss>
		</item>
		<item>
		<title>linux下Rsync同步镜像服务器配置教程</title>
		<link>http://tech.foolpig.com/2010/04/29/linux-rsync/</link>
		<comments>http://tech.foolpig.com/2010/04/29/linux-rsync/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 06:14:49 +0000</pubDate>
		<dc:creator>foolpig</dc:creator>
		
		<category><![CDATA[东写西读]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[rsync]]></category>

		<guid isPermaLink="false">http://tech.foolpig.com/2010/04/29/linux-rsync/</guid>
		<description><![CDATA[主服务器：192.168.0.220 (CentOS 4.4) 从服务器：192.168.0.248 (CentOS 5) ============================== 1&#62; 在两台主机上分别安装rsync ====================== 
默认一般都是安装了的 

1
2
&#91;root@office ~&#93;# rpm -qa&#124... ]]></description>
			<content:encoded><![CDATA[<p>主服务器：192.168.0.220 (CentOS 4.4) <br />从服务器：192.168.0.248 (CentOS 5) <br /><font color="#ff8000">============================== 1&gt; 在两台主机上分别安装rsync ======================</font> </p>
<p>默认一般都是安装了的 </p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>office ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># rpm -qa|grep rsync</span>
rsync-2.6.3-<span style="color: #000000;">1</span></pre></td></tr></table></div>

<p>如果没有安装，使用yum install rsync来进行安装即可； 正常情况很快就安装完毕,rsync 服务器架设比较简单，可我们安装好rsync后，并没有发现配置文件以及rsync服务器启动程序，因为每个管理员可能对rsync 用途不一样，所以一般的发行版只是安装好软件就完事了，让管理员来根据自己的用途和方向来自己架设rsync服务器。 </p>
<p><font color="#ff8000">============================== 2&gt; rsync服务器的配置 ==============================</font> </p>
<p>在/etc目录下创建一个rsyncd的目录，我们用来存放rsyncd.conf，rsyncd.secrets和rsyncd.motd文件； rsyncd.conf 是rsync服务器的主配置文件； rsyncd.secrets是用户密码文件； rsyncd.motd配置一些服务欢迎及说明信息； </p>
<p>a&gt;创建修改 rsyncd.conf </p>
<p>rsyncd.conf 是rsync服务器主要配置文件，我们来个简单的示例；比如我们要备份服务器上的 /tmp/目录 ，在/tmp/ 中，我想把test目录和test.php文件排除在外； </p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>office ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># cd /etc</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>office ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># mkdir rsyncd</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>office ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># cd rsyncd</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>office ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># vi rsyncd.conf</span></pre></td></tr></table></div>

<p>写入(保证文件中每行没有空格): </p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">pid <span style="color: #c20cb9; font-weight: bold;">file</span> = <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>rsyncd.pid
port = <span style="color: #000000;">873</span>
address = 192.168.0.220
<span style="color: #666666; font-style: italic;">#uid = nobody</span>
<span style="color: #666666; font-style: italic;">#gid = nobody</span>
uid = root
gid = root
&nbsp;
use <span style="color: #c20cb9; font-weight: bold;">chroot</span> = <span style="color: #c20cb9; font-weight: bold;">yes</span>
<span style="color: #c20cb9; font-weight: bold;">read</span> only = <span style="color: #c20cb9; font-weight: bold;">yes</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#limit access to private LANs</span>
<span style="color: #666666; font-style: italic;">#设置可访问的主机：如果多个ip则用空格隔开：192.168.0.3 192.168.0.4 192.168.0.5或者设置区间 192.168.0.3/5</span>
hosts <span style="color: #007800;">allow</span>=192.168.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span>
hosts <span style="color: #007800;">deny</span>=<span style="color: #000000; font-weight: bold;">*</span>
&nbsp;
max connections = <span style="color: #000000;">5</span>
motd <span style="color: #c20cb9; font-weight: bold;">file</span> = <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>rsyncd<span style="color: #000000; font-weight: bold;">/</span>rsyncd.motd
&nbsp;
<span style="color: #666666; font-style: italic;">#This will give you a separate log file</span>
log <span style="color: #c20cb9; font-weight: bold;">file</span> = <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>rsync.log
&nbsp;
<span style="color: #666666; font-style: italic;">#This will log every file transferred - up to 85,000+ per user, per sync</span>
transfer logging = <span style="color: #c20cb9; font-weight: bold;">yes</span>
&nbsp;
log format = <span style="color: #000000; font-weight: bold;">%</span>t <span style="color: #000000; font-weight: bold;">%</span>a <span style="color: #000000; font-weight: bold;">%</span>m <span style="color: #000000; font-weight: bold;">%</span>f <span style="color: #000000; font-weight: bold;">%</span>b
syslog facility = local3
timeout = <span style="color: #000000;">300</span>
<span style="color: #666666; font-style: italic;">#方括号中设置模块名</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>linuxsirhome<span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #666666; font-style: italic;">#要同步服务器的目录路径</span>
path = <span style="color: #000000; font-weight: bold;">/</span>backup
<span style="color: #007800;">list</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span>
ignore errors
<span style="color: #666666; font-style: italic;">#auth users是必须在服务器上存在的真实的系统用户，如果你想用多个用户，那就以,号隔开；比如 auth users = ljzhou,rsyncsir</span>
auth <span style="color: #c20cb9; font-weight: bold;">users</span> = ljzhou
<span style="color: #666666; font-style: italic;">#从服务器访问需要的密码文件</span>
secrets <span style="color: #c20cb9; font-weight: bold;">file</span> = <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>rsyncd<span style="color: #000000; font-weight: bold;">/</span>rsyncd.secrets
comment = linuxsir tmp
<span style="color: #666666; font-style: italic;">#设置不同步的目录或文件用空格隔开</span>
exclude = test<span style="color: #000000; font-weight: bold;">/</span> test.php</pre></td></tr></table></div>

<p>b&gt; 创建修改密码文件rsyncd.secrets</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>office ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># cd /etc/rsyncd</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>office ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># vi rsyncd.secrets</span></pre></td></tr></table></div>

<p>写入： ljzhou:123456 退出保存。修改权限密码文件的权限：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>office ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># chmod 600 rsyncd.secrets</span></pre></td></tr></table></div>

<p>c&gt; 创建修改rsync.motd文件 </p>
<p>rsyncd.motd是定义rysnc 服务器信息的，也就是用户登录信息。比如让用户知道这个服务器是谁提供的等；类似ftp服务器登录时，我们所看到的 linuxsir.org ftp ……。 当然这在全局定义变量时，并不是必须的，你可以用#号注掉，或删除；如： </p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>office ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># vi rsyncd.motd</span></pre></td></tr></table></div>

<p>写入： welcome! </p>
<p><font color="#ff8000">============================== 3&gt; 启动rsync服务==============================</font> </p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>office ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># /usr/bin/rsync --daemon  --config=/etc/rsyncd/rsyncd.conf</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">&nbsp;</pre></td></tr></table></div>

<p><font color="#ff8000">============================== 4&gt; 主服务器已经配置好rsync！下面我们设置从服务器============</font> </p>
<p>从服务器只需安装rsync即可，然后运行： </p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>devel ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># /usr/bin/rsync -vzrtopg --progress ljzhou@192.168.0.220::linuxsirhome  /tmp</span></pre></td></tr></table></div>

<p>#因为没有指定密码文件，所以需要手动输入主服务器上的设定的密码输入密码：123456 ljzhou是指定密码文件中的用户名 ::linuxsirhome 表示在rsyncd.conf中设置的模块名 /tmp是从服务器目录(192.168.0.248/tmp) 到此为止，rsync的两台主机之间(192.168.0.220/tmp和192.168.0.248/tmp)的rsync同步已经配置完毕，只要在从服务器执行上述命令输入密码即可同步。 </p>
<p><font color="#ff8000">============================== 5&gt; 设置主从服务器定定时自动同步==============================</font> </p>
<p>自动同步要用到从服务器上的cron服务，关于cron的介绍请参考：linux定时执行系统我们在从服务器即192.168.0.248的/tmp目录下创建两个rsync.sh文件和rsync.secrets文件。 rsync.sh文件是cron要执行的脚本文件。 rsync.secrets是保存主服务器密码的文件。 </p>
<p>a&gt; 创建rsync.sh文件 </p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>devel ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># cd /tmp</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>devel ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># vi rsync.sh</span></pre></td></tr></table></div>

<p>写入: /usr/bin/rsync -vzrtopg &#8211;progress ljzhou@192.168.0.220::linuxsirhome /tmp &#8211;password-file=/tmp/rsync.secrets </p>
<p>退出保存。</p>
<p>b&gt; 创建rsync.secrets密码文件 </p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>devel ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># vi rsync.secrets</span></pre></td></tr></table></div>

<p>写入： 123456 </p>
<p>退出保存并修改权限： </p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>devel ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># chmod 600 rsync.secrets</span></pre></td></tr></table></div>

<p>c&gt; 配置cron服务</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>devel ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># crontab -e</span></pre></td></tr></table></div>

<p>添加一行： */1 * * * * /web/www/rsync.sh //即每分钟同步一次退出保存，rsync.sh 这个文件放置于一个妥善保存的地方，不要泄露密码。 </p>
<p>设置完毕，以后每隔一分钟即会把主服务器/tmp目录更新至从服务器/tmp。 </p>
]]></content:encoded>
			<wfw:commentRss>http://tech.foolpig.com/2010/04/29/linux-rsync/feed/</wfw:commentRss>
		</item>
		<item>
		<title>在Windows Live Writer中设置代码显示插件</title>
		<link>http://tech.foolpig.com/2010/04/29/wlw/</link>
		<comments>http://tech.foolpig.com/2010/04/29/wlw/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 05:11:04 +0000</pubDate>
		<dc:creator>foolpig</dc:creator>
		
		<category><![CDATA[东写西读]]></category>

		<category><![CDATA[wlw]]></category>

		<category><![CDATA[代码]]></category>

		<category><![CDATA[插件]]></category>

		<guid isPermaLink="false">http://tech.foolpig.com/2010/04/29/wlw/</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;&#160; 我一直用Windows Live Writer写博客，感觉很不错，唯一有点让我很不方便的时，如果我要在日志中放入代码，让代码按一定的格式显示，就很不方便了。
&#160;&#160;&#160;&#160;&#... ]]></description>
			<content:encoded><![CDATA[<p>&#160;&#160;&#160;&#160;&#160; 我一直用Windows Live Writer写博客，感觉很不错，唯一有点让我很不方便的时，如果我要在日志中放入代码，让代码按一定的格式显示，就很不方便了。</p>
<p>&#160;&#160;&#160;&#160;&#160; 其实对于WordPress显示代码有很多的插件，不过这些插件只能在线写作时用到，如果放在Windows Live Writer中使用的话，要切换到源代码模式下手写代码进去才行，还是不方便，哪么，有没有让我们像编辑图片一样方便的来编辑代码了？</p>
<p>&#160;&#160;&#160;&#160;&#160; 一定是有的。我这里有使用Wordpress的WP-Syntax代码高亮插件及网友自己开发的一个Live Writer插件来做设置。</p>
<p><strong>&#160;&#160;&#160;&#160;&#160; 第一步：</strong>下载WP-Syntax插件，并在你的WordPress后台安装；    <br />&#160;&#160;&#160;&#160;&#160; 下载地址：<a href="http://wordpress.org/extend/plugins/wp-syntax/">http://wordpress.org/extend/plugins/wp-syntax/</a></p>
<p><strong>&#160;&#160;&#160;&#160;&#160; 第二步：</strong>下载网友开发的插件并做安装；    <br />&#160;&#160;&#160;&#160;&#160; 下载地址：<a href="http://www.blogjava.net/Files/wintys/WintyCodeAreaWLWPluginSetup.zip">http://www.blogjava.net/Files/wintys/WintyCodeAreaWLWPluginSetup.zip</a></p>
<p><strong>&#160;&#160;&#160;&#160;&#160; 第三步：</strong>在Windows Live Writer 中配置上面第二步安装的插件：    <br />&#160;&#160;&#160;&#160;&#160; 点击：工具-&gt;选项-&gt;插件-&gt;启用WintyCodeArea    <br />&#160;&#160;&#160;&#160;&#160; 再点击选项如下进行设置：如我经常的插<strong>件Java代码，所以就lang=”Java”，</strong>你可以把这个换行你经常插入的代码语言。</p>
<p>&#160;&#160;&#160;&#160;&#160; 可以支持很多的lang，请<a href="http://wordpress.org/extend/plugins/wp-syntax/other_notes/" target="_blank">参考</a> ，我常用的是bash，python，php等</p>
<p><a href="http://tech.foolpig.com/wp-content/uploads/2010/04/image1.png"><img title="image1" style="border-right: 0px; border-top: 0px; display: block; float: none; margin-left: auto; border-left: 0px; margin-right: auto; border-bottom: 0px" height="286" alt="image1" src="http://tech.foolpig.com/wp-content/uploads/2010/04/image1-thumb.png" width="363" border="0" /></a> </p>
<p><strong>&#160;&#160;&#160;&#160;&#160; 第四步：</strong>在写日志是使用，点击插入-&gt;WintyCodeArea就可以了，不过还要切换到<strong>源代码</strong>显示下插入你要的源代码。</p>
<p>&#160;&#160;&#160;&#160;&#160; 最后效果如下</p>
<p><a href="http://tech.foolpig.com/wp-content/uploads/2010/04/image2.png"><img title="image2" style="border-right: 0px; border-top: 0px; display: block; float: none; margin-left: auto; border-left: 0px; margin-right: auto; border-bottom: 0px" height="255" alt="image2" src="http://tech.foolpig.com/wp-content/uploads/2010/04/image2-thumb.png" width="363" border="0" /></a> </p>
</p>
<p>转载自：<a href="http://wangbaoming.com/windows-live-writer-code-show-wordpress.html">http://wangbaoming.com/windows-live-writer-code-show-wordpress.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tech.foolpig.com/2010/04/29/wlw/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
