<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>后院&#124;kevin’s backyard &#187; linux</title>
	<atom:link href="http://kevin.9511.net/archives/tag/linux/feed" rel="self" type="application/rss+xml" />
	<link>http://kevin.9511.net</link>
	<description>立志做一个混事业型男人</description>
	<lastBuildDate>Fri, 30 Apr 2010 16:55:05 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>使用SCP和Cron进行数据备份</title>
		<link>http://kevin.9511.net/archives/406.html</link>
		<comments>http://kevin.9511.net/archives/406.html#comments</comments>
		<pubDate>Thu, 10 Dec 2009 11:15:36 +0000</pubDate>
		<dc:creator>kevin</dc:creator>
				<category><![CDATA[七零八碎]]></category>
		<category><![CDATA[crontab]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[scp]]></category>

		<guid isPermaLink="false">http://kevin.9511.net/?p=406</guid>
		<description><![CDATA[服务器间的数据同步，rsync的确是个好方式，不过它只能被动同步而不能主动分发。
本想使用SVN+rsync的方案进行代码的管理，可是因为上面说到的原因，无法达到代码的即时分发。
遂想起SCP这个东西，但SCP每次执行必须要在控制台输入手动输入密码，于是就Google到了下面这个文章。
人家说的是用SCP进行数据备份，我是用来跟SVN的hook功能一起达到即时分发代码的目的，原理是一样的。
实在懒的翻译了，文章来自：http://www.spaceprogram.com/knowledge/cron_scp.html
Introduction
This document will explain the steps required to use scp in cron. This is generally useful to do automated backups on Linux and other nix variations.
Instructions
These instructions will walk you through what it takes.
1. Generate a private/public key pair 
Simple command to do this:
ssh-keygen -t rsa
Leave the passphrase empty so that cron can use it [...]]]></description>
			<content:encoded><![CDATA[<p>服务器间的数据同步，rsync的确是个好方式，不过它只能被动同步而不能主动分发。</p>
<p>本想使用SVN+rsync的方案进行代码的管理，可是因为上面说到的原因，无法达到代码的即时分发。</p>
<p>遂想起SCP这个东西，但SCP每次执行必须要在控制台输入手动输入密码，于是就Google到了下面这个文章。</p>
<p>人家说的是用SCP进行数据备份，我是用来跟SVN的hook功能一起达到即时分发代码的目的，原理是一样的。<span id="more-406"></span></p>
<p>实在懒的翻译了，文章来自：<a href="http://www.spaceprogram.com/knowledge/cron_scp.html" target="_blank">http://www.spaceprogram.com/knowledge/cron_scp.html</a></p>
<h5>Introduction</h5>
<p>This document will explain the steps required to use scp in cron. This is generally useful to do automated backups on Linux and other nix variations.</p>
<h5>Instructions</h5>
<p>These instructions will walk you through what it takes.</p>
<p><strong>1. Generate a private/public key pair </strong></p>
<p>Simple command to do this:</p>
<div>ssh-keygen -t rsa</div>
<p>Leave the passphrase empty so that cron can use it passwordless. Just         be sure nobody gets your private key.</p>
<p><strong>2. Copy the public key to the remote server </strong></p>
<div>scp ~/.ssh/id_rsa.pub remote_host:</div>
<p><strong>3. Add local key to remote servers trusted key </strong></p>
<p>Log on to the remote server and if there has never been a key created         for this user on the remote machine, run the <span>ssh-keygen         -t rsa</span> just to get the key directory and stuff set up.</p>
<p>Then concatenate the new key to your authorized_keys file:</p>
<p>cat ~/id_rsa.pub &gt;&gt; ~/.ssh/authorized_keys</p>
<p>Now for some reason, you may have to do this to the keys file:</p>
<p>chmod 644 ~/.ssh/authorized_keys</p>
<p><strong>4. Now try logging into the remote machine again from local </strong></p>
<p>ssh REMOTE_USERNAME@remote_host</p>
<p>This <em>should</em> log you in without asking for a password. If it doesn&#8217;t, then something must be wrong at this point and you should go through the steps above again.</p>
<p>This should also mean that scp will work the same way and you might want to test that scp works by copying a file from local to remote using scp. If no password, then we&#8217;re all good.</p>
<p><strong>5. Now lets test out cron script</strong></p>
<p>My cron script for this example is simply going to copy a directory         of files using scp to the remote server.</p>
<p>scp -r /PATH_TO_FILES/ REMOTE_USER@remote_host:BACKUPS/</p>
<p>And that&#8217;s about all she wrote. Save that in a file called backup.sh (or whatever you want to call it), chmod 755 i it and then try running it. ./backup.sh to run it. If it works, then next stop is to cron it.</p>
<p><strong>6. Add script to cron jobs</strong></p>
<p>Easiest way is to simply copy the backup.sh file into /etc/cron.daily/ . This will make it run every day. Choose another cron.SOMETIME to make it run more or less often. If you want more control on when it&#8217;s run, read up on adding it to the crontab.</p>
]]></content:encoded>
			<wfw:commentRss>http://kevin.9511.net/archives/406.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>2003年的一篇文档</title>
		<link>http://kevin.9511.net/archives/319.html</link>
		<comments>http://kevin.9511.net/archives/319.html#comments</comments>
		<pubDate>Fri, 14 Aug 2009 08:54:58 +0000</pubDate>
		<dc:creator>kevin</dc:creator>
				<category><![CDATA[七零八碎]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://kevin.9511.net/?p=319</guid>
		<description><![CDATA[刚刚清理台式机上文件，发现了一篇2003年在量子的时候写的一篇配置局域网Linux网关服务器的文档。虽然罗嗦了挺长，其实就是用iptables把请求转来转去。现在看来简单的很，当初却是研究了好几天的成果……
http://rui7905.googlecode.com/files/LinuxGW.rar
]]></description>
			<content:encoded><![CDATA[<p>刚刚清理台式机上文件，发现了一篇2003年在量子的时候写的一篇配置局域网Linux网关服务器的文档。虽然罗嗦了挺长，其实就是用iptables把请求转来转去。现在看来简单的很，当初却是研究了好几天的成果……</p>
<blockquote><p><a href="http://rui7905.googlecode.com/files/LinuxGW.rar" target="_blank">http://rui7905.googlecode.com/files/LinuxGW.rar</a></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://kevin.9511.net/archives/319.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ProFTPD搭载sqlite3，简单配置轻量级FTP服务器</title>
		<link>http://kevin.9511.net/archives/182.html</link>
		<comments>http://kevin.9511.net/archives/182.html#comments</comments>
		<pubDate>Mon, 20 Apr 2009 16:15:10 +0000</pubDate>
		<dc:creator>kevin</dc:creator>
				<category><![CDATA[技术备案]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[proftpd]]></category>
		<category><![CDATA[sqlite]]></category>

		<guid isPermaLink="false">http://kevin.9511.net/archives/182.html</guid>
		<description><![CDATA[所谓简单，是因为ProFTPD的一些复杂功能都没有写进来，比如用户磁盘空间配额、上传下载速率限制等。
所谓轻量级，是因为配这个平台，是为了公司内部使用，用户有限。更复杂的配置，日后再说吧:)
网上的很多关于ProFTPD搭载数据库进行管理的文章，大多用的都是MySQL(搜baidu的结果)和PostgreSQL(搜google的结果)，可是单单为了一个公司内部使用的这么一个小平台，使用这么两个重量级的数据库，是在有点杀鸡用牛刀的感觉。对于我的需求，Sqlite这个轻量级的嵌入式数据库，显然是最最合适的选择。在网上跑来跑去找了1个多小时，也没有一篇像样的配置文档，甚至连ProFTPD的官方doc里，提起sqlite也是只言片语。没办法，只有自己对着英文的Howto，自己摸索了。
1，Install Sqlite3 and ProFTPD
下载安装Sqlite3最新版：http://www.sqlite.org/
#tar -zxf sqlite-amalgamation-3.6.13.tar.gz
#cd sqlite-3.6.13/
#./configure
#make
#make install
下载安装ProFTPD最新版：http://www.proftpd.org/
ProFTPD对于数据库的支持，并不是通过linux的PAM方式来实现的
而是内置了模块，这点曾经让我走了很多弯路，TMD居然没有文章提及这点。使用sqlite模块:
#tar -zxf proftpd-1.3.2.tar.gz
#cd proftpd-1.3.2
#./configure &#8211;prefix=/usr/local/proftpd &#8211;with-modules=mod_sql:mod_sql_sqlite
#make
#make install
2，配置ProFTPD
编辑/usr/local/proftpd/etc/proftpd.conf文件，加入下面列出来的这一大坨参数。
这里只说说跟Sqlite3有关的参数，其他比较有用的参数配置说明，满世界都是。完整配置文件放在最后。
其实除了SQLBackend和SQLConnectInfo两个参数之外，剩下的一些参数在配置其他数据库时也会用到
我在配置这些数据库相关参数的时候，走了很多弯路，查了很多文档，记下来也给自己脑子备个份。
#首先来说这俩，定义proftpd以什么身份来运行，跟apache里的是一个意思
#我是习惯了apache定义为www用户和www组，配置proftpd也就这样了
#以什么身份运行，我个人感觉没啥特别意义，关键是虚拟用户对实体用户的映射！
User                    www
Group                   www
#sqlite2跟3差别较大，各软件平台对其支持也是分开来的，比如PHP
#这里就是指明，使用sqlite3
SQLBackend sqlite3
#数据库文件的绝对路径，一定要绝对
SQLConnectInfo /home/www/ftpd.db
#数据库内虚拟用户的密码认证方式
#我认为Backend的意思就是数据库自己的认证方式，比如mysql的password方案
#该方案可以指定多种，使用空格隔开，按照先后，依次try
#下面这句的意思就是“先用sqlite自己的认证方式(我用的明文，其他解决方案没研究)
#如果不行，再使用crypt(3)的方案”，实际配置文件里我只要了一个Backend
SQLAuthTypes [...]]]></description>
			<content:encoded><![CDATA[<p>所谓简单，是因为<a title="Highly configurable GPL-licensed FTP server software " href="http://www.proftpd.org/" target="_blank">ProFTPD</a>的一些复杂功能都没有写进来，比如用户磁盘空间配额、上传下载速率限制等。<br />
所谓轻量级，是因为配这个平台，是为了公司内部使用，用户有限。更复杂的配置，日后再说吧:)</p>
<p>网上的很多关于ProFTPD搭载数据库进行管理的文章，大多用的都是MySQL(搜baidu的结果)和PostgreSQL(搜google的结果)，可是单单为了一个公司内部使用的这么一个小平台，使用这么两个重量级的数据库，是在有点杀鸡用牛刀的感觉。对于我的需求，<a title="a lightweight embeddable database system" href="http://www.sqlite.org" target="_blank">Sqlite</a>这个轻量级的嵌入式数据库，显然是最最合适的选择。在网上跑来跑去找了1个多小时，也没有一篇像样的配置文档，甚至连ProFTPD的官方doc里，提起sqlite也是只言片语。没办法，只有自己对着英文的Howto，自己摸索了。</p>
<p><strong>1，Install Sqlite3 and ProFTPD</strong><br />
下载安装Sqlite3最新版：http://www.sqlite.org/</p>
<blockquote><p>#tar -zxf sqlite-amalgamation-3.6.13.tar.gz<br />
#cd sqlite-3.6.13/<br />
#./configure<br />
#make<br />
#make install</p></blockquote>
<p>下载安装ProFTPD最新版：http://www.proftpd.org/<br />
<span style="color: #ff6600;">ProFTPD对于数据库的支持，并不是通过linux的PAM方式来实现的<br />
而是内置了模块，这点曾经让我走了很多弯路，TMD居然没有文章提及这点。使用sqlite模块:</span></p>
<blockquote><p>#tar -zxf proftpd-1.3.2.tar.gz<br />
#cd proftpd-1.3.2<br />
#./configure &#8211;prefix=/usr/local/proftpd &#8211;with-modules=mod_sql:mod_sql_sqlite<br />
#make<br />
#make install</p></blockquote>
<p><strong>2，配置ProFTPD</strong><br />
编辑/usr/local/proftpd/etc/proftpd.conf文件，加入下面列出来的这一大坨参数。<br />
这里只说说跟Sqlite3有关的参数，其他比较有用的参数配置说明，满世界都是。完整配置文件放在最后。<br />
其实除了SQLBackend和SQLConnectInfo两个参数之外，剩下的一些参数在配置其他数据库时也会用到<br />
我在配置这些数据库相关参数的时候，走了很多弯路，查了很多文档，记下来也给自己脑子备个份。</p>
<blockquote><p>#首先来说这俩，定义proftpd以什么身份来运行，跟apache里的是一个意思<br />
#我是习惯了apache定义为www用户和www组，配置proftpd也就这样了<br />
#以什么身份运行，我个人感觉没啥特别意义，关键是虚拟用户对实体用户的映射！<br />
<span style="color: #ff6600;">User                    www<br />
Group                   www</span><br />
#sqlite2跟3差别较大，各软件平台对其支持也是分开来的，比如PHP<br />
#这里就是指明，使用sqlite3<br />
<span style="color: #ff6600;">SQLBackend sqlite3</span><br />
#数据库文件的绝对路径，一定要绝对<br />
<span style="color: #ff6600;">SQLConnectInfo /home/www/ftpd.db</span><br />
#数据库内虚拟用户的密码认证方式<br />
#我认为Backend的意思就是数据库自己的认证方式，比如mysql的password方案<br />
#该方案可以指定多种，使用空格隔开，按照先后，依次try<br />
#下面这句的意思就是“先用sqlite自己的认证方式(我用的明文，其他解决方案没研究)<br />
#如果不行，再使用crypt(3)的方案”，实际配置文件里我只要了一个Backend<br />
<span style="color: #ff6600;">SQLAuthTypes Backend Crypt</span><br />
#自定义存放用户信息的表和字段<br />
#下面这句的意思就是<br />
#users表 里的 字段：用户名 密码 系统映射uid 系统映射gid 主目录 shell路径<br />
#切记：表和字段的名字可以随便起(跟实际数据库中的表和字段相对应)，但顺序不可乱<br />
#按照我对英文howto的理解，前4个字段名是必须要设置的，后两个如果自己用不上<br />
#必须使用NULL来填补，这样mod_sql模块就不会去检索这俩字段了<br />
<span style="color: #ff6600;">SQLUserInfo users user_name user_passwd uid gid home_dir NULL</span><br />
#如果主目录字段名设置为NULL，那么这里这个就必须要定义<br />
#这个是用来定义那些没有“主目录定义的用户”的主目录，有点绕口:P<br />
<span style="color: #ff6600;">#SQLDefaultHomedir &#8220;/tmp&#8221;</span><br />
#这个参数设置为off的意思，是不让proftpd去检查该FTP用户映射到系统里的用户的shell<br />
#就是说，有没有shell，我都让你登陆。特别是上面的字段，将shell路径这个设置为了NULL<br />
<span style="color: #ff6600;">RequireValidShell off</span><br />
#组信息，没啥意思，就这么放着吧，意思跟上面那个SQLUserInfo一样<br />
#表名 组名 组id 成员<br />
<span style="color: #ff6600;">SQLGroupInfo groups group_name gid members</span><br />
#这里是用户身份认证的程度，只验证user，连带group啥的都验证<br />
#图简单，我这里只验证user这一层<br />
<span style="color: #ff6600;">SQLAuthenticate users</span><br />
#设置ProFTPD允许登陆的最小UID，这个UID是映射到linux系统内实际用户的UID，小于这个值将不允许登陆<br />
#这个值如果不设置，系统默认的是999，在很多国内的文章里，uid和gid都是设置5000多<br />
#所以即使不管这个值，也不会有问题，可是如果你跟我一样，映射用户的uid和gid都小于999了，就要注意它了<br />
#我的www用户的uid和gid都是504，在这里，卡了我有一个多小时，TNND<br />
<span style="color: #ff6600;">SQLMinUserUID 500</span><br />
#这两个的意思，是所有未在数据库中定义uid和gid的用户的默认uid及gid<br />
<span style="color: #ff6600;">SQLDefaultUID 504</span><br />
<span style="color: #ff6600;">SQLDefaultGID 504</span></p></blockquote>
<p>我的完整的proftpd.conf文件</p>
<blockquote><p><a href="http://rui7905.googlecode.com/svn/trunk/proftpd_sqlite3" target="_blank">http://rui7905.googlecode.com/svn/trunk/proftpd_sqlite3</a></p></blockquote>
<p><strong>3，建立数据库及用户表</strong><br />
#sqlite3 /home/www/ftpd.db 数据库就建好了，简单吧~<br />
其实理论上，这个文件的路径，是放在哪里都可以的。我配置完这个平台后，又用php写了一个简单的管理平台<br />
为了方便我的apache运行用户www读写数据库，就放在了www的主目录下。。<br />
在sqlite3环境下，用下面这个语句建立数据表</p>
<blockquote><p>CREATE TABLE &#8220;users&#8221; (&#8221;user_name&#8221; varchar(20), &#8220;user_passwd&#8221; varchar(50), &#8220;uid&#8221; int(11) NOT NULL  DEFAULT 504, &#8220;gid&#8221; int(11) NOT NULL  DEFAULT 504, &#8220;home_dir&#8221; varchar(200), &#8220;shell&#8221; varchar(200))</p></blockquote>
<p>下面创建一个新用户：</p>
<blockquote><p>INSERT INTO &#8220;users&#8221; VALUES(&#8217;test&#8217;,'test&#8217;,504,504,&#8217;/home/www/ftp/test&#8217;,NULL);</p></blockquote>
<p>表的uid和gid的默认值都设置为了504，即www用户在系统内的uid和gid的值。新添加字段时，这两个字段我也设置了。www用户和组在我系统内是早就建好的，uid和gid分别都是504。通过这两个字段的值，就完成了proftpd内的虚拟用户跟系统内实体用户的映射。具体到自己，请根据实际情况来设置这两个字段的默认值，及新添加记录的值。<br />
<strong>4，最后</strong><br />
到现在，整个配置应该是完成了，使用这个命令来启动ProFTPD:</p>
<blockquote><p>/usr/local/proftpd/sbin/proftpd -c /usr/local/proftpd/etc/proftpd.conf &amp;</p></blockquote>
<p>参考资料：<br />
ProFTPD Howto:SQL and mod_sql:<br />
<a title="ProFTPD Howto:SQL and mod_sql" href="http://www.proftpd.org/docs/howto/SQL.html" target="_blank">http://www.proftpd.org/docs/howto/SQL.html</a><br />
ProFTPD module mod_sql:<br />
<a title="ProFTPD module mod_sql" href="http://www.proftpd.org/docs/contrib/mod_sql.html" target="_blank">http://www.proftpd.org/docs/contrib/mod_sql.html</a><br />
ProFTPD module mod_sql_sqlite:<br />
<a title="ProFTPD module mod_sql_sqlite" href="http://www.proftpd.org/docs/contrib/mod_sql_sqlite.html">http://www.proftpd.org/docs/contrib/mod_sql_sqlite.html</a><br />
Configuration Directive List:<br />
<a title="Configuration Directive List" href="http://www.proftpd.org/docs/directives/linked/by-name.html" target="_blank">http://www.proftpd.org/docs/directives/linked/by-name.html</a><br />
Simple MySQL Authentication:<br />
<a title="Simple MySQL Authentication" href="http://www.proftpd.org/docs/configs/mysql_simple.conf" target="_blank">http://www.proftpd.org/docs/configs/mysql_simple.conf</a></p>
]]></content:encoded>
			<wfw:commentRss>http://kevin.9511.net/archives/182.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>nginx 和 subversion</title>
		<link>http://kevin.9511.net/archives/179.html</link>
		<comments>http://kevin.9511.net/archives/179.html#comments</comments>
		<pubDate>Tue, 31 Mar 2009 18:42:34 +0000</pubDate>
		<dc:creator>kevin</dc:creator>
				<category><![CDATA[技术备案]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://kevin.9511.net/archives/179.html</guid>
		<description><![CDATA[实在厌倦了apache的臃肿，打算彻底投奔nginx的怀抱了。
编译，安装，迁移，一切都很顺利 ，最后一步在迁移svn的时候卡住了。
把nginx作为subversion的前端webserver居然目前没有解决方案……
搞了一个晚上，最终还是采取了proxy的办法，把发向nginx的svn请求转到apache上去了 ，哎。
为啥nginx没有这方面的解决方案，也大概查了个水落石出。因为这方面中文资料实在是少，让我费了颇多的周折，
现在就明明白白的说一下吧。
在nginx.net的Mailing list里，nginx的作者Igor Sysoev说了，支持SVN需要有三个东西
 1) full WebDAV support,
2) DeltaV support,
3) SVN repo format support.
而在nginx里的NginxHttpDavModule，仅仅对以上三项中的第一项WebDAV有了初步的支持(目前来看Igor Sysoev并没有升级的想法)，对于几个高级的WebDAV操作（比如OPTIONS、PROPFIND）并不支持，而这些操作，恰恰是SVN所必须的。而剩下的两项，更是一点支持都没。
所以，就目前来说，想单纯的nginx+subversion，基本上是不可能的。
在刚开始研究这个问题的时候，并不知道除了WebDAV还必须要有其他两个东西。所以满世界找nginx上WebDAV的解决方案，以为搞定这个，就万事大吉了。别说，还真让我在一个老外的博客上给找着一个。这家伙的方法很巧妙，他用通过查阅WebDAV的RFC文档，将绝大多数NginxHttpDavModule不支持的操作用PHP代码实现了，并且通过配置nginx，根据header信息把这些请求重定向到了这个PHP程序。这是这篇博客的地址，有志于自己动手解决这个问题的人，可以参考一下：）
最后感叹一下，为什么计算机方面的问题，总是能在国外的网站和MaillingList找到答案呢？是中国人都不会么？还是这些问题只有我这一个中国人遇到了？
]]></description>
			<content:encoded><![CDATA[<p>实在厌倦了apache的臃肿，打算彻底投奔nginx的怀抱了。<br />
编译，安装，迁移，一切都很顺利 ，最后一步在迁移svn的时候卡住了。<br />
把nginx作为subversion的前端webserver居然目前没有解决方案……</p>
<p>搞了一个晚上，最终还是采取了proxy的办法，把发向nginx的svn请求转到apache上去了 ，哎。<br />
为啥nginx没有这方面的解决方案，也大概查了个水落石出。因为这方面中文资料实在是少，让我费了颇多的周折，<br />
现在就明明白白的说一下吧。</p>
<p>在nginx.net的<a href="http://marc.info/?l=nginx" title="MARC archive" target="_blank">Mailing list</a>里，nginx的作者Igor Sysoev说了，支持SVN需要有三个东西</p>
<blockquote><p> 1) full WebDAV support,<br />
2) DeltaV support,<br />
3) SVN repo format support.</p></blockquote>
<p>而在nginx里的NginxHttpDavModule，仅仅对以上三项中的第一项WebDAV有了初步的支持(目前来看Igor Sysoev并没有升级的想法)，对于几个高级的WebDAV操作（比如OPTIONS、PROPFIND）并不支持，而这些操作，恰恰是SVN所必须的。而剩下的两项，更是一点支持都没。</p>
<p><strong>所以，就目前来说，想单纯的nginx+subversion，基本上是不可能的。</strong></p>
<p>在刚开始研究这个问题的时候，并不知道除了WebDAV还必须要有其他两个东西。所以满世界找nginx上WebDAV的解决方案，以为搞定这个，就万事大吉了。别说，还真让我在一个老外的博客上给找着一个。这家伙的方法很巧妙，他用通过查阅<a href="http://www.ietf.org/rfc/rfc2518.txt" title="RFC2518">WebDAV的RFC文档</a>，将绝大多数NginxHttpDavModule不支持的操作用PHP代码实现了，并且通过配置nginx，根据header信息把这些请求重定向到了这个PHP程序。<a href="http://blog.agoragames.com/2009/03/20/webdav-nginx-play-nice/">这是这篇博客的地址</a>，有志于自己动手解决这个问题的人，可以参考一下：）</p>
<p>最后感叹一下，为什么计算机方面的问题，总是能在国外的网站和MaillingList找到答案呢？是中国人都不会么？还是这些问题只有我这一个中国人遇到了？</p>
]]></content:encoded>
			<wfw:commentRss>http://kevin.9511.net/archives/179.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Install subversion-1.5.2 on Linux</title>
		<link>http://kevin.9511.net/archives/178.html</link>
		<comments>http://kevin.9511.net/archives/178.html#comments</comments>
		<pubDate>Tue, 31 Mar 2009 06:14:04 +0000</pubDate>
		<dc:creator>kevin</dc:creator>
				<category><![CDATA[技术备案]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[subversion]]></category>

		<guid isPermaLink="false">http://kevin.9511.net/archives/178.html</guid>
		<description><![CDATA[1，Install Apache,APR and APR-util(http://apr.apache.org/)
 #tar -zxf apr-1.3.3.tar.gz
#cd apr-1.3.3
#./configure
#make
#make install
 #tar -zxf apr-util-1.3.4.tar.gz
#cd apr-util-1.3.4
#./configure &#8211;with-apr=/usr/local/apr/
#make
#make install
编译apache，加如下参数
 &#8211;enable-dav &#8211;with-apr=/usr/local/apr/bin/apr-1-config &#8211;with-apr-util=/usr/local/apr/bin/apu-1-config
2. Install Neon(http://www.webdav.org/neon/)
neon is an HTTP and WebDAV client library, with a C interface.
 #tar -zxf neon-0.28.3.tar.gz
#cd neon-0.28.3
#./configure &#8211;prefix=/usr/local/neon
#make
#make install
3. Install Subversion (http://subversion.tigris.org/)
 #tar -zxf subversion-1.5.2.tar.gz
#cd subversion-1.5.2
#./configure &#8211;prefix=/usr/local/subversion &#8211;with-apxs=/usr/local/apache2/bin/apxs &#8211;with-apr=/usr/local/apr &#8211;with-apr-util=/usr/local/apr &#8211;with-neon=/usr/local/neon
#make
#make install
编译过程中，发生如下错误
/usr/bin/ld: cannot find -lexpat
collect2: ld returned [...]]]></description>
			<content:encoded><![CDATA[<p><strong>1，Install Apache,APR and APR-util</strong>(http://apr.apache.org/)</p>
<blockquote><p> #tar -zxf apr-1.3.3.tar.gz<br />
#cd apr-1.3.3<br />
#./configure<br />
#make<br />
#make install</p></blockquote>
<blockquote><p> #tar -zxf apr-util-1.3.4.tar.gz<br />
#cd apr-util-1.3.4<br />
#./configure &#8211;with-apr=/usr/local/apr/<br />
#make<br />
#make install</p></blockquote>
<p>编译apache，加如下参数</p>
<blockquote><p> &#8211;enable-dav &#8211;with-apr=/usr/local/apr/bin/apr-1-config &#8211;with-apr-util=/usr/local/apr/bin/apu-1-config</p></blockquote>
<p><strong>2. Install Neon</strong>(http://www.webdav.org/neon/)<br />
neon is an HTTP and WebDAV client library, with a C interface.</p>
<blockquote><p> #tar -zxf neon-0.28.3.tar.gz<br />
#cd neon-0.28.3<br />
#./configure &#8211;prefix=/usr/local/neon<br />
#make<br />
#make install</p></blockquote>
<p><strong>3. Install Subversion</strong> (http://subversion.tigris.org/)</p>
<blockquote><p> #tar -zxf subversion-1.5.2.tar.gz<br />
#cd subversion-1.5.2<br />
#./configure &#8211;prefix=/usr/local/subversion &#8211;with-apxs=/usr/local/apache2/bin/apxs &#8211;with-apr=/usr/local/apr &#8211;with-apr-util=/usr/local/apr &#8211;with-neon=/usr/local/neon<br />
#make<br />
#make install</p></blockquote>
<p>编译过程中，发生如下错误</p>
<blockquote><p>/usr/bin/ld: cannot find -lexpat<br />
collect2: ld returned 1 exit status</p></blockquote>
<p>确认libexpat已经被载入</p>
<blockquote><p># ldconfig -p|grep expat<br />
libexpat.so.0 (libc6) =&gt; /usr/lib/libexpat.so.0</p></blockquote>
<p>做个链接，并重载libs，最后检查一下</p>
<blockquote><p>#cd /usr/lib<br />
#ln -s libexpat.so.0.5.0 libexpat.so<br />
#ldconfig<br />
#ldconfig -p|grep expat<br />
libexpat.so.0 (libc6) =&gt; /usr/lib/libexpat.so.0<br />
libexpat.so (libc6) =&gt; /usr/lib/libexpat.so</p></blockquote>
<p>继续编译，通过，OY<br />
<strong>4. 配置</strong><br />
打开apache的httpd.conf文件，查找下面两行内容，如果存在，则表示subversion已经安装成功</p>
<blockquote><p>LoadModule dav_svn_module     modules/mod_dav_svn.so<br />
LoadModule authz_svn_module   modules/mod_authz_svn.so</p></blockquote>
<p>建立代码仓库及配置文件</p>
<blockquote><p>#cd /usr/local/subversion/<br />
#mkdir repos<br />
#mkdir www<br />
#touch auth<br />
#cd repos<br />
#svnadmin create myproject</p></blockquote>
<p>通过apache的htpasswd工具创建用户，并按提示输入密码</p>
<blockquote><p>#cd ..<br />
#/usr/local/apache2/bin/htpasswd -c /usr/local/subversion/passwd kevin</p></blockquote>
<p>编辑auth文件，写入以下内容，赋予此用户对于myproject的读写权限（例子很简单，更复杂的权限配置，请自己去查官方文档或google搜索“SVN权限”）</p>
<blockquote><p> [/]<br />
* = rw</p>
<p>[/svn]<br />
* = rw</p>
<p>[/svn/myproject]<br />
lirui=rw</p></blockquote>
<p>配置apache，设置svn的工作目录</p>
<blockquote><p> &lt;Location /svn&gt;<br />
DAV svn<br />
SVNParentPath /usr/local/subversion/repos<br />
AuthType Basic<br />
AuthName &#8220;Subversion repository&#8221;<br />
AuthUserFile /usr/local/subversion/passwd<br />
AuthzSVNAccessFile /usr/local/subversion/auth<br />
Require valid-user<br />
&lt;/Location&gt;</p></blockquote>
<p>重启apache</p>
]]></content:encoded>
			<wfw:commentRss>http://kevin.9511.net/archives/178.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>总结：ldconfig及 LD_LIBRARY_PATH</title>
		<link>http://kevin.9511.net/archives/177.html</link>
		<comments>http://kevin.9511.net/archives/177.html#comments</comments>
		<pubDate>Mon, 30 Mar 2009 21:56:53 +0000</pubDate>
		<dc:creator>kevin</dc:creator>
				<category><![CDATA[技术备案]]></category>
		<category><![CDATA[ldconfig]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://kevin.9511.net/archives/177.html</guid>
		<description><![CDATA[为了装个nginx，在一个裸机上折腾了一宿。
也不知道是机器慢，还是的确如此，编译gcc花了快一个小时。。。很是吐血。
结果编译安装完成后，去编译其他东西，结果发现了找不到编译器的提示。。。
东查西找，左蒙右猜，终于把问题搞定了，问题就出在这个 LD_LIBRARY_PATH 上面
从别处摘抄总结一下。
 1. 往/lib和/usr/lib里面加东西，是不用修改/etc/ld.so.conf的，但是完了之后要调一下ldconfig，不然这个library会找不到
2. 想往上面两个目录以外加东西的时候，一定要修改/etc/ld.so.conf，然后再调用ldconfig，不然也会找不到
比如安装了一个mysql到/usr/local/mysql，mysql有一大堆library在/usr/local/mysql/lib下面，这时就需要在/etc/ld.so.conf下面加一行/usr/local/mysql/lib，保存过后ldconfig一下，新的library才能在程序运行时被找到。
3. 如果想在这两个目录以外放lib，但是又不想在/etc/ld.so.conf中加东西（或者是没有权限加东西）。那也可以，就是export一个全局变量LD_LIBRARY_PATH，然后运行程序的时候就会去这个目录中找library。一般来讲这只是一种临时的解决方案，在没有权限或临时需要的时候使用。
4. ldconfig做的这些东西都与运行程序时有关，跟编译时一点关系都没有。编译的时候还是该加-L就得加，不要混淆了。
5. 总之，就是不管做了什么关于library的变动后，最好都ldconfig一下，不然会出现一些意想不到的结果。不会花太多的时间，但是会省很多的事。
LD_LIBRARY_PATH 的意思：告诉loader在哪些目录中可以找到共享库。可以设置多个搜索目录，这些目录之间用冒号分隔开。在linux下，还提供了另外一种方式来完成同样的功能，你可以把这些目录加到/etc/ld.so.conf中，或则在/etc/ld.so.conf.d里创建一个文件，把目录加到这个文件里。当然，这是系统范围内全局有效的，而环境变量只对当前shell有效。按照惯例，除非你用上述方式指明，loader是不会在当前目录下去找共享库的，正如shell不会在当前目前找可执行文件一样。
]]></description>
			<content:encoded><![CDATA[<p>为了装个nginx，在一个裸机上折腾了一宿。</p>
<p>也不知道是机器慢，还是的确如此，编译gcc花了快一个小时。。。很是吐血。</p>
<p>结果编译安装完成后，去编译其他东西，结果发现了找不到编译器的提示。。。</p>
<p>东查西找，左蒙右猜，终于把问题搞定了，问题就出在这个 LD_LIBRARY_PATH 上面</p>
<p>从别处摘抄总结一下。</p>
<blockquote><p> 1. 往/lib和/usr/lib里面加东西，是不用修改/etc/ld.so.conf的，但是完了之后要调一下ldconfig，不然这个library会找不到</p>
<p>2. 想往上面两个目录以外加东西的时候，一定要修改/etc/ld.so.conf，然后再调用ldconfig，不然也会找不到<br />
比如安装了一个mysql到/usr/local/mysql，mysql有一大堆library在/usr/local/mysql/lib下面，这时就需要在/etc/ld.so.conf下面加一行/usr/local/mysql/lib，保存过后ldconfig一下，新的library才能在程序运行时被找到。</p>
<p>3. 如果想在这两个目录以外放lib，但是又不想在/etc/ld.so.conf中加东西（或者是没有权限加东西）。那也可以，就是export一个全局变量LD_LIBRARY_PATH，然后运行程序的时候就会去这个目录中找library。一般来讲这只是一种临时的解决方案，在没有权限或临时需要的时候使用。</p>
<p>4. ldconfig做的这些东西都与运行程序时有关，跟编译时一点关系都没有。编译的时候还是该加-L就得加，不要混淆了。</p>
<p>5. 总之，就是不管做了什么关于library的变动后，最好都ldconfig一下，不然会出现一些意想不到的结果。不会花太多的时间，但是会省很多的事。</p></blockquote>
<p>LD_LIBRARY_PATH 的意思：告诉loader在哪些目录中可以找到共享库。可以设置多个搜索目录，这些目录之间用冒号分隔开。在linux下，还提供了另外一种方式来完成同样的功能，你可以把这些目录加到/etc/ld.so.conf中，或则在/etc/ld.so.conf.d里创建一个文件，把目录加到这个文件里。当然，这是系统范围内全局有效的，而环境变量只对当前shell有效。按照惯例，除非你用上述方式指明，loader是不会在当前目录下去找共享库的，正如shell不会在当前目前找可执行文件一样。</p>
]]></content:encoded>
			<wfw:commentRss>http://kevin.9511.net/archives/177.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>linux下用tcpdump命令截获soap信息</title>
		<link>http://kevin.9511.net/archives/174.html</link>
		<comments>http://kevin.9511.net/archives/174.html#comments</comments>
		<pubDate>Mon, 23 Mar 2009 10:43:53 +0000</pubDate>
		<dc:creator>kevin</dc:creator>
				<category><![CDATA[技术备案]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[tcpdump]]></category>
		<category><![CDATA[抓包]]></category>

		<guid isPermaLink="false">http://kevin.9511.net/archives/174.html</guid>
		<description><![CDATA[this is probably the easiest way to monitor SOAP messages.
simply use
#tcpdump -i eth0 -A -s 1024 port 80 &#124; tee dump.log
to log all the packet sent to port 80 to dump.log
]]></description>
			<content:encoded><![CDATA[<p>this is probably the easiest way to monitor SOAP messages.</p>
<p>simply use</p>
<p>#tcpdump -i eth0 -A -s 1024 port 80 | tee dump.log</p>
<p>to log all the packet sent to port 80 to dump.log</p>
]]></content:encoded>
			<wfw:commentRss>http://kevin.9511.net/archives/174.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP5下安装sqlite模块的小问题</title>
		<link>http://kevin.9511.net/archives/169.html</link>
		<comments>http://kevin.9511.net/archives/169.html#comments</comments>
		<pubDate>Sun, 12 Oct 2008 21:43:23 +0000</pubDate>
		<dc:creator>kevin</dc:creator>
				<category><![CDATA[技术备案]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[sqlite]]></category>

		<guid isPermaLink="false">http://kevin.9511.net/archives/169.html</guid>
		<description><![CDATA[今天在用pecl为PHP5编译安装sqlite模块的时候，遇到了下面这个错误而编译不过去
sqlite.c:56: error: &#8216;BYREF_NONE&#8217; undeclared here (not in a function)
GOOGLE一番，原来这是个从2006年7月就存在的BUG。虽然官方在pecl.php.net的关于此bug的详情页里说已经修复了，但不止一个人在1年甚至2年后依然表示错误依旧～！看来老外干活也会偷懒啊，出了sqlite3的模块，老的sqlite模块就不维护了，哎～～
在那个页面里，也有人提供了自己修复此BUG的方法：
1，来到PHP安装目录内的bin目录下
cd /usr/local/php-5.2.3/bin
2，下载这个模块的源码
pecl download sqlite
3，解压并开始编译
$ tar zxvf SQLite-1.0.3.tgz
$ cd SQLite-1.0.3
$ ../phpize
$ ./configure &#8211;with-php-config=/usr/local/php-5.2.3/bin/php-config
$ make
4，在make的过程如报告以上错误则编辑sqlite.c文件，将下面这行注释掉
/* static unsigned char arg3_force_ref[] = {3, BYREF_NONE, BYREF_NONE, BYREF_FORCE }; */
然后将下面这三行
function_entry sqlite_functions[] = {
PHP_FE(sqlite_open, arg3_force_ref)
PHP_FE(sqlite_popen, arg3_force_ref)
改为:
function_entry sqlite_functions[] = {
PHP_FE(sqlite_open, third_arg_force_ref)
PHP_FE(sqlite_popen, third_arg_force_ref)
5，重新编译
$ make
$ make install
将编译生成的sqlite.so文件，复制到extension_dir指定的目录中，编辑php.ini文件，加入如下一行
extension=sqlite.so
重启web服务后即可
]]></description>
			<content:encoded><![CDATA[<p>今天在用pecl为PHP5编译安装sqlite模块的时候，遇到了下面这个错误而编译不过去</p>
<blockquote><p>sqlite.c:56: error: &#8216;BYREF_NONE&#8217; undeclared here (not in a function)</p></blockquote>
<p>GOOGLE一番，原来这是个从2006年7月就存在的BUG。虽然官方在<a href="http://pecl.php.net/bugs/bug.php?id=8181" target="_blank">pecl.php.net的关于此bug的详情页</a>里说已经修复了，但不止一个人在1年甚至2年后依然表示错误依旧～！看来老外干活也会偷懒啊，出了sqlite3的模块，老的sqlite模块就不维护了，哎～～</p>
<p>在那个页面里，也有人提供了自己修复此BUG的方法：<br />
1，来到PHP安装目录内的bin目录下</p>
<blockquote><p>cd /usr/local/php-5.2.3/bin</p></blockquote>
<p>2，下载这个模块的源码</p>
<blockquote><p>pecl download sqlite</p></blockquote>
<p>3，解压并开始编译</p>
<blockquote><p>$ tar zxvf SQLite-1.0.3.tgz<br />
$ cd SQLite-1.0.3<br />
$ ../phpize<br />
$ ./configure &#8211;with-php-config=/usr/local/php-5.2.3/bin/php-config<br />
$ make</p></blockquote>
<p>4，在make的过程如报告以上错误则编辑sqlite.c文件，将下面这行注释掉</p>
<blockquote><p>/* static unsigned char arg3_force_ref[] = {3, BYREF_NONE, BYREF_NONE, BYREF_FORCE }; */</p></blockquote>
<p>然后将下面这三行</p>
<blockquote><p>function_entry sqlite_functions[] = {<br />
PHP_FE(sqlite_open, arg3_force_ref)<br />
PHP_FE(sqlite_popen, arg3_force_ref)</p></blockquote>
<p>改为:</p>
<blockquote><p>function_entry sqlite_functions[] = {<br />
PHP_FE(sqlite_open, third_arg_force_ref)<br />
PHP_FE(sqlite_popen, third_arg_force_ref)</p></blockquote>
<p>5，重新编译</p>
<blockquote><p>$ make<br />
$ make install</p></blockquote>
<p>将编译生成的sqlite.so文件，复制到extension_dir指定的目录中，编辑php.ini文件，加入如下一行</p>
<blockquote><p>extension=sqlite.so</p></blockquote>
<p>重启web服务后即可</p>
]]></content:encoded>
			<wfw:commentRss>http://kevin.9511.net/archives/169.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HowTo: Install Nginx and php-fpm on Linux</title>
		<link>http://kevin.9511.net/archives/166.html</link>
		<comments>http://kevin.9511.net/archives/166.html#comments</comments>
		<pubDate>Fri, 19 Sep 2008 07:15:19 +0000</pubDate>
		<dc:creator>kevin</dc:creator>
				<category><![CDATA[技术备案]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php-fpm]]></category>

		<guid isPermaLink="false">http://kevin.9511.net/archives/166.html</guid>
		<description><![CDATA[最近要为公司搭建新的开发环境，打算舍弃用了n年的apache，换换口味，装个nginx试试。
在网上找了很多文档，没有一个能让我顺利安装完成的。还是自己来整理整理吧……
1，Install Pcre
来这里获取Pcre的最新版本
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
#tar -zxf pcre-7.8.tar.gz
#cd pcre-7.8
#./configure
#make
#make install
2. Install Nginx(http://www.nginx.net/)
#tar -zxf nginx-0.6.32.tar.gz
#cd nginx-0.6.32
#./configure &#8211;prefix=/usr/local/nginx-0.6.32
#make
#make install
3. Install PHP with php-fpm (http://www.php.net/)
nginx是通过fastcgi来支持PHP的，使用php-fpm补丁是一个比较方便的管理fastcgi进程的解决方案。
比通过脚本或是lighttpd的spawn模块要简单的多。
下载好PHP后，来这里获取与PHP版本相对应的php-fpm补丁：http://php-fpm.anight.org/
#tar -zxf php-5.2.6.tar.gz
#cd php-5.2.6
#zcat ../php-5.2.6-fpm-0.5.8.diff.gz &#124; patch -p1  #为PHP打补丁
#./configure &#8211;prefix=/usr/local/php-5.2.6 &#8211;with-sqlite=shared &#8211;enable-fastcgi &#8211;enable-fpm
#make
#make install
 注：PHP的其他模块(如mysql、gd等)请按需自己配置
#cp php.ini-recommended /usr/local/php-5.2.6/lib/php.ini
修改php.ini
cgi.fix_pathinfo=1
4. Configuring
A. 配置nginx，在/usr/local/nginx-0.6.32/conf目录下新建名为php_fcgi.conf的文件，内容如下：
location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
修改nginx.conf文件，在需要支持PHP的虚拟主机配置中，加入如下一行：
include php_fcgi.conf;
B. 配置php-fpm模块，编辑/usr/local/php-5.2.6/etc/php-fpm.conf文件
找到“Unix user of processes”和“Unix group of processes”两段，将前面注释去掉，并将值改为与nginx配置相同的用户和组。如下：
Unix user of processes
&#60;value [...]]]></description>
			<content:encoded><![CDATA[<p>最近要为公司搭建新的开发环境，打算舍弃用了n年的apache，换换口味，装个nginx试试。<br />
在网上找了很多文档，没有一个能让我顺利安装完成的。还是自己来整理整理吧……</p>
<p><strong>1，Install Pcre</strong></p>
<p>来这里获取Pcre的最新版本<br />
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/</p>
<blockquote><p>#tar -zxf pcre-7.8.tar.gz<br />
#cd pcre-7.8<br />
#./configure<br />
#make<br />
#make install</p></blockquote>
<p><strong>2. Install Nginx</strong>(http://www.nginx.net/)</p>
<blockquote><p>#tar -zxf nginx-0.6.32.tar.gz<br />
#cd nginx-0.6.32<br />
#./configure &#8211;prefix=/usr/local/nginx-0.6.32<br />
#make<br />
#make install</p></blockquote>
<p><strong>3. Install PHP with php-fpm</strong> (http://www.php.net/)</p>
<p>nginx是通过fastcgi来支持PHP的，使用php-fpm补丁是一个比较方便的管理fastcgi进程的解决方案。<br />
比通过脚本或是lighttpd的spawn模块要简单的多。</p>
<p>下载好PHP后，来这里获取与PHP版本相对应的php-fpm补丁：http://php-fpm.anight.org/</p>
<blockquote><p>#tar -zxf php-5.2.6.tar.gz<br />
#cd php-5.2.6<br />
#zcat ../php-5.2.6-fpm-0.5.8.diff.gz | patch -p1  <span style="color: #ff6600;">#为PHP打补丁</span><br />
#./configure &#8211;prefix=/usr/local/php-5.2.6 &#8211;with-sqlite=shared &#8211;enable-fastcgi &#8211;enable-fpm<br />
#make<br />
#make install<br />
<span style="color: #ff6600;"> 注：PHP的其他模块(如mysql、gd等)请按需自己配置</span></p>
<p>#cp php.ini-recommended /usr/local/php-5.2.6/lib/php.ini</p></blockquote>
<p>修改php.ini</p>
<blockquote><p>cgi.fix_pathinfo=1</p></blockquote>
<p><strong>4. Configuring</strong></p>
<p>A. 配置nginx，在/usr/local/nginx-0.6.32/conf目录下新建名为php_fcgi.conf的文件，内容如下：</p>
<blockquote><p>location ~ .php$ {<br />
fastcgi_pass 127.0.0.1:9000;<br />
fastcgi_index index.php;<br />
include fastcgi_params;<br />
<span style="color: #ff6600;">fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;</span><br />
}</p></blockquote>
<p>修改nginx.conf文件，在需要支持PHP的虚拟主机配置中，加入如下一行：</p>
<blockquote><p>include php_fcgi.conf;</p></blockquote>
<p>B. 配置php-fpm模块，编辑/usr/local/php-5.2.6/etc/php-fpm.conf文件<br />
找到“Unix user of processes”和“Unix group of processes”两段，将前面注释去掉，并将值改为与nginx配置相同的用户和组。如下：</p>
<blockquote><p>Unix user of processes<br />
&lt;value name=&#8221;user&#8221;&gt;www&lt;/value&gt;</p>
<p>Unix group of processes<br />
&lt;value name=&#8221;group&#8221;&gt;www&lt;/value&gt;</p></blockquote>
<p><strong>5. Test and Over</strong></p>
<p>至此，所有安装配置的工作都已经完成。运行下面两行命令来启动nginx和php-fpm服务：</p>
<blockquote><p>/usr/local/php-5.2.6/sbin/php-fpm start<br />
/usr/local/nginx-0.6.32/sbin/nginx</p></blockquote>
<p>正确配置后，phpinfo() 页应如下显示：<br />
<img src="http://kevin.9511.net/wp-content/uploads/2008/09/phf.png" alt="phf.png" /><br />
CGI/FastCGI work as Server API<br />
<img src="http://kevin.9511.net/wp-content/uploads/2008/09/phf2.png" alt="phf2.png" /><a title="phf2.png" href="http://kevin.9511.net/wp-content/uploads/2008/09/phf2.png"><br />
</a></p>
<p>由于文件内容太长，nginx.conf和虚拟主机的配置文件的内容就不放上来了<br />
将这些乱七八糟的配置文件和php-fpm.conf一起打个包，放在这里提供下载吧</p>
<blockquote><p><a href="http://rui7905.googlecode.com/svn/trunk/nginx_php_fpm" target="_blank">http://rui7905.googlecode.com/svn/trunk/nginx_php_fpm</a></p></blockquote>
<p>在这一堆东西里，还有一个名为nginx.sh的启动控制脚本。<br />
当确认nginx和php-fpm均正确的配置并可以正常运行后，可以使用此脚本进行日常维护。</p>
]]></content:encoded>
			<wfw:commentRss>http://kevin.9511.net/archives/166.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>悲哀：红旗出藏文Linux了</title>
		<link>http://kevin.9511.net/archives/148.html</link>
		<comments>http://kevin.9511.net/archives/148.html#comments</comments>
		<pubDate>Tue, 11 Sep 2007 17:47:22 +0000</pubDate>
		<dc:creator>kevin</dc:creator>
				<category><![CDATA[七零八碎]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[红旗]]></category>
		<category><![CDATA[藏文]]></category>

		<guid isPermaLink="false">http://kevin.9511.net/archives/148.html</guid>
		<description><![CDATA[刚刚在cnBeta看了个新闻“基于红旗Linux的藏文操作系统通过信产部验收”，文中说的“此项目是国内第一个实现全藏文化的Linux操作系统，填补了国内空白”，看到这句话，真是想吐。更可笑的，这个东西居然还“顺利通过信息产业部组织的项目验收”。
做过程序的人都应该清楚，给一个操作系统增加一个语言外壳相对于做一个完整的操作系统，简直就是如同认识26个英文字母跟讲一口流利的英文之间的差别。从来也没听说过微软为了推出某个语言版本的windows操作系统，去联合某国公司、某国科学院软件研究所、某大学，并为此立项攻关，到最后还能落个填补某国科技空白的名头。
向来对红旗这个公司以及背后的中科院计算机所没什么好感。记得99年红旗刚出第一个版本的linux时，我是怀着相当激动的心情，买来正版光盘(虽然没几个钱，可的确是正版)打算领略一下中国人自己的linux。可就是这个号称自主研发汉化的中文linux发行版，在安装的时候，居然还留有redhat的字样……当时那个汗啊。把人家redhat的东西拿过来，然后把表现层的提示、说明等等改成中文，就成了这个所谓的“自主研发汉化的中文linux”，而且干这点事，都不好好干，还留着人家的信息。还没人家蓝点linxu强呢，起码人家还有个linux下的中文输入法呢。
中国计算机技术发展并不比国外晚几年，为啥跟世界的差距越来越大呢？从操作系统到编程语言，从CPU到显示器，除了使用和组装，计算机领域里面有什么东西的发明是跟中国有哪怕一丁点的关系？人家巴西也是发展中国家吧？没咱中国富吧(猜的)？可人家巴西人发明的lua语言，就能被现在全世界最流行的网游魔兽世界做为嵌入式脚本语言来进行客户端的UI开发和玩家的再开发。还有更甚者，就连倭人都开发出了一种叫Ruby的语言，而且目前甚是流行。可回过头来看咱中国人，花大价钱整了一套人家外国公司玩剩下的CPU技术，还能组织一帮号称专家学者的东西研究个1年半载。
也可能是俺上学少见识浅，实在是搞不懂中科院的那帮所谓的科学家、研究员都在研究些啥高深的东西。在这么个一片和谐的社会氛围中，俺就不去遐想那些每年按亿计算的研发经费的趋向了。其实看看“红旗”现在还能够有精力去研究“藏文linux”，也能猜个八九不离十。有13亿人口的中国，到现在就没有一个能拿图灵奖。唯一一个拿过图灵奖的华人还是个生中国长在台湾学在美国的老头。当然台湾人也是中国人，就算你丫在美国把国籍换了，那也是中国人，就因为你丫拿了图灵奖了，跟杨振宁李政道他们一个操性。
哎，时间不早了，就扯到这吧，再往下扯，就不知道会扯出什么蛋了。在这段举国和谐的时刻，蛋扯乱了可不是什么好事。
]]></description>
			<content:encoded><![CDATA[<p>刚刚在cnBeta看了个新闻“<a href="http://www.cnbeta.com/articles/38702.htm" target="_blank">基于红旗Linux的藏文操作系统通过信产部验收</a>”，文中说的“此项目是国内第一个实现全藏文化的Linux操作系统，填补了国内空白”，看到这句话，真是想吐。更可笑的，这个东西居然还“顺利通过信息产业部组织的项目验收”。</p>
<p>做过程序的人都应该清楚，给一个操作系统增加一个语言外壳相对于做一个完整的操作系统，简直就是如同认识26个英文字母跟讲一口流利的英文之间的差别。从来也没听说过微软为了推出某个语言版本的windows操作系统，去联合某国公司、某国科学院软件研究所、某大学，并为此立项攻关，到最后还能落个填补某国科技空白的名头。</p>
<p>向来对红旗这个公司以及背后的中科院计算机所没什么好感。记得99年红旗刚出第一个版本的linux时，我是怀着相当激动的心情，买来正版光盘(虽然没几个钱，可的确是正版)打算领略一下中国人自己的linux。可就是这个号称自主研发汉化的中文linux发行版，在安装的时候，居然还留有redhat的字样……当时那个汗啊。把人家redhat的东西拿过来，然后把表现层的提示、说明等等改成中文，就成了这个所谓的“自主研发汉化的中文linux”，而且干这点事，都不好好干，还留着人家的信息。还没人家蓝点linxu强呢，起码人家还有个linux下的中文输入法呢。</p>
<p>中国计算机技术发展并不比国外晚几年，为啥跟世界的差距越来越大呢？从操作系统到编程语言，从CPU到显示器，除了使用和组装，计算机领域里面有什么东西的发明是跟中国有哪怕一丁点的关系？人家巴西也是发展中国家吧？没咱中国富吧(猜的)？可人家巴西人发明的lua语言，就能被现在全世界最流行的网游魔兽世界做为嵌入式脚本语言来进行客户端的UI开发和玩家的再开发。还有更甚者，就连倭人都开发出了一种叫Ruby的语言，而且目前甚是流行。可回过头来看咱中国人，花大价钱整了一套人家外国公司玩剩下的CPU技术，还能组织一帮号称专家学者的东西研究个1年半载。</p>
<p>也可能是俺上学少见识浅，实在是搞不懂中科院的那帮所谓的科学家、研究员都在研究些啥高深的东西。在这么个一片和谐的社会氛围中，俺就不去遐想那些每年按亿计算的研发经费的趋向了。其实看看“红旗”现在还能够有精力去研究“藏文linux”，也能猜个八九不离十。有13亿人口的中国，到现在就没有一个能拿图灵奖。唯一一个拿过图灵奖的华人还是个生中国长在台湾学在美国的老头。当然台湾人也是中国人，就算你丫在美国把国籍换了，那也是中国人，就因为你丫拿了图灵奖了，跟杨振宁李政道他们一个操性。</p>
<p>哎，时间不早了，就扯到这吧，再往下扯，就不知道会扯出什么蛋了。在这段举国和谐的时刻，蛋扯乱了可不是什么好事。</p>
]]></content:encoded>
			<wfw:commentRss>http://kevin.9511.net/archives/148.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Linux下编译PHP时遇到的安装libmcrypt库的问题</title>
		<link>http://kevin.9511.net/archives/103.html</link>
		<comments>http://kevin.9511.net/archives/103.html#comments</comments>
		<pubDate>Mon, 20 Aug 2007 13:53:18 +0000</pubDate>
		<dc:creator>kevin</dc:creator>
				<category><![CDATA[技术备案]]></category>
		<category><![CDATA[libltdl]]></category>
		<category><![CDATA[libmcrypt]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mhash]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://kevin.9511.net/archives/103</guid>
		<description><![CDATA[./configure &#8211;prefix=/usr/local/php-5.2.3 &#8211;enable-module=so &#8211;with-mysql=/usr/local/mysql-5.1.20 &#8211;with-apxs2=/usr/local/apache-2.2.4/bin/apxs &#8211;enable-mbstring &#8211;with-mcrypt
通过以上命令配置PHP时，遇到错误，总说找不到libmcrypt。由于这服务器是个裸机，很多必须的库都没装，必须一个一个的手动安装，可libmcrypt这个库我的确装过了。重试n遍，无解。在网上找了半天，终于在phpbuilder.com的一个maillist里发现一个哥们儿遇到的问题跟我差不多，按照他的方法做了一下，居然解决了。原文在这：http://www.phpbuilder.com/lists/php-install/2004032/0090.php
做为一个懒人，我就不逐句翻译了，摘抄解决办法如下：
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-
the solution
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-
Then I visited
http://mcrypt.hellug.gr/mcrypt/index.html
an learned that I have to install not only libmcrypt
but also mcrypt and libmhash.
Here is the to do:
libmcrytp:
&#8212;&#8212;&#8212;&#8211;
download libmcrypt-xxx.tar.gz
create the following directory: / usr / local / libmcrypt
copy the libmcrypt-xxx.tar.gz into that directory and move to it
run the following shell (&#62;) commands: (&#8217;xxx&#8217; is the version [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>./configure &#8211;prefix=/usr/local/php-5.2.3 &#8211;enable-module=so &#8211;with-mysql=/usr/local/mysql-5.1.20 &#8211;with-apxs2=/usr/local/apache-2.2.4/bin/apxs &#8211;enable-mbstring &#8211;with-mcrypt</p></blockquote>
<p>通过以上命令配置PHP时，遇到错误，总说找不到libmcrypt。由于这服务器是个裸机，很多必须的库都没装，必须一个一个的手动安装，可libmcrypt这个库我的确装过了。重试n遍，无解。在网上找了半天，终于在phpbuilder.com的一个maillist里发现一个哥们儿遇到的问题跟我差不多，按照他的方法做了一下，居然解决了。原文在这：<a title="PHPBuilder" href="http://www.phpbuilder.com/lists/php-install/2004032/0090.php" target="_blank">http://www.phpbuilder.com/lists/php-install/2004032/0090.php</a><span id="more-103"></span></p>
<p>做为一个懒人，我就不逐句翻译了，摘抄解决办法如下：</p>
<blockquote><p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
the solution<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
Then I visited<br />
http://mcrypt.hellug.gr/mcrypt/index.html<br />
an learned that I have to install not only libmcrypt<br />
but also mcrypt and libmhash.</p>
<p>Here is the to do:</p>
<p>libmcrytp:<br />
&#8212;&#8212;&#8212;&#8211;<br />
download libmcrypt-xxx.tar.gz<br />
create the following directory: / usr / local / libmcrypt<br />
copy the libmcrypt-xxx.tar.gz into that directory and move to it<br />
run the following shell (&gt;) commands: (&#8217;xxx&#8217; is the version number)<br />
&gt; gunzip -c libmcrypt-xxx.tar.gz | tar xf -<br />
&gt; cd libmcrypt-xxx<br />
&gt; ./configure &#8211;disable-posix-threads<br />
&gt; make<br />
&gt; make check (note: &#8216;make check&#8217; is optional)<br />
&gt; make install<br />
then (update your environment) add in / etc / profile the following path:<br />
/usr/local/libmcrypt/libmcrypt-xxxx<br />
(note: as I run Red Hat 7.3 I set the line a f t e r the if-part<br />
(id -u = 0 &#8230;) with: pathmunge /usr/local / libm&#8230;.)<br />
and add in / etc / ld.so.conf the following path: /usr/local/lib<br />
then run ldconfig:<br />
&gt; ldconfig<br />
now comes the important part:<br />
&gt; cd /usr/local/libmcrypt/libmcrypt-xxx/libltdl<br />
&gt; ./configure &#8211;enable-ltdl-install<br />
&gt; make<br />
&gt; make install</p>
<p>(maybe not needed: I also added a link in / usr / bin: )<br />
(&gt; cd /usr/bin)<br />
(&gt; ln -s /usr/lib/libltdl.so.3.1.0 ltdl)</p>
<p>mhash:<br />
&#8212;&#8212;&#8212;&#8211;<br />
download mhash-xxx.tar.gz<br />
create the following directory: / usr / local / mhash<br />
copy the mhash-xxx.tar.gz into that directory and move to it<br />
run the following shell (&gt;) commands: (&#8217;xxx&#8217; is the version number)<br />
&gt; gunzip -c mhash-xxx.tar.gz | tar xf -<br />
&gt; cd mhash-xxx<br />
&gt; ./configure<br />
&gt; make<br />
&gt; make check (note: &#8216;make check&#8217; is optional)<br />
&gt; make install</p>
<p>mcrypt:<br />
&#8212;&#8212;&#8212;&#8211;<br />
download mcrypt-xxx.tar.gz<br />
create the following directory: / usr / local / mcrypt<br />
copy the mcrypt-xxx.tar.gz into that directory and move to it<br />
run the following shell (&gt;) commands: (&#8217;xxx&#8217; is the version number)<br />
&gt; gunzip -c mcrypt-xxx.tar.gz | tar xf -<br />
&gt; cd mhash-xxx<br />
&gt; ./configure<br />
&gt; make<br />
&gt; make check (note: &#8216;make check&#8217; is optional)<br />
&gt; make install</p>
<p>back to PHP:<br />
&#8212;&#8212;&#8212;&#8212;&#8211;<br />
move into your PHP installation directory<br />
then the following command worked on my computer:<br />
&gt;<br />
./configure &#8211;with-apache=/usr/local/apache/apache_1.3.29 &#8211;with-mysql &#8211;wit<br />
h-mcrypt=/usr/local/mcrypt/mcrypt-2.6.4<br />
&gt; make<br />
&gt; make install</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8211;<br />
that�s it</p>
<p>Hopefully that will help you to save some hours deep in the night :-)</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://kevin.9511.net/archives/103.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

