<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet href='http://feed.feedsky.com/styles/temp01.xsl' type='text/xsl' ?><!--这是一个由Feedsy提供技术支持的Feed，为了提高读者阅读的体验，以及满足用户美化自己Feed的需要，我们设计了多种精美的Feed模板，提供给大家选择，所有最终呈现出来的样式，皆由用户自愿选择使用，未经许可，任何团体和个人，请不要擅自修改样式或者盗用，这是对于用户选择权的尊重。--><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:fs="http://www.feedsky.com/namespace/feed" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link href="http://feed.feedsky.com/since2006" type="application/rss+xml" rel="self"></atom:link><fs:self_link href="http://feed.feedsky.com/since2006" type="application/rss+xml"></fs:self_link><lastBuildDate>Sat, 11 Feb 2012 15:47:00 GMT</lastBuildDate><title>since2006</title><description>YY</description><image><url>http://www.feedsky.com/feed/since2006/sc/gif</url><title>since2006</title><link>http://since2006.com</link></image><link>http://since2006.com</link><pubDate>Sat, 11 Feb 2012 16:33:07 GMT</pubDate><item><title>延长Cornerstone试用期限</title><link>http://item.feedsky.com/~feedsky/since2006/~8093926/604824717/6199459/1/item.html</link><description>Cornerstone是Mac OS下一款强大的SVN客户端，不过试用周期只有14天。&lt;br&gt;&lt;br&gt;可以用下面方法重置试用期限，不过如果这款程序真的帮到大家，亲～请购买正版哦。&lt;br&gt;&lt;br&gt;1.显示系统隐藏文件&lt;br&gt;&lt;br&gt;在终端（Terminal）中输入如下命令：defaults write ~/Library/Preferences/com.apple.finder AppleShowAllFiles -bool true&lt;br&gt;&lt;br&gt;为true时显示隐藏文件，为false是不显示隐藏文件。执行完后需重启。&lt;br&gt;&lt;br&gt;2.打开~/Library/Preferences/ByHost下的.GlobalPreferences.XXXX.plist文件，XXXX为一串疑似UUID一样的字符串。&lt;img src=&quot;/js/HTMLEditor/image/emot/em02.gif&quot;&gt;&lt;br&gt;&lt;br&gt;删除其中类似&amp;lt;key&amp;gt;com.zennaware.Cornerstone:2.6&amp;lt;/key&amp;gt;&amp;lt;data&amp;gt;......&amp;lt;/data&amp;gt;的行。&lt;br&gt;&lt;br&gt;3.保存，打开Cornerstone试试。&lt;br&gt;&lt;br&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/604824717/since2006/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/since2006/~8093926/604824717/6199459/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><pubDate>Sat, 11 Feb 2012 23:47:00 +0800</pubDate><author>hee</author><guid isPermaLink="false">http://since2006.com/blog/cornerstone-trial-period/</guid><dc:creator>hee</dc:creator><fs:srclink>http://since2006.com/blog/cornerstone-trial-period/</fs:srclink><fs:srcfeed>http://since2006.com/feed</fs:srcfeed><fs:itemid>feedsky/since2006/~8093926/604824717/6199459</fs:itemid></item><item><title>解决Nginx 500错误</title><link>http://item.feedsky.com/~feedsky/since2006/~8093926/604824718/6199459/1/item.html</link><description>这几天打开另一个网站频繁出现500错误，上VPS看nginx日志，错误主要有“No space left on device”和“24: Too many open files”。&lt;BR&gt;&lt;BR&gt;现学现卖一个一个问题的解决：&lt;BR&gt;No space left on device&lt;BR&gt;看起来像是没有剩余空间了&lt;BR&gt;
&lt;OL&gt;
&lt;LI&gt;执行“df -m”后，发现可用空间为0% 
&lt;LI&gt;使用“du -sh /*”可以查看指定目录下哪个文件占用空间最大 
&lt;LI&gt;一路追踪下去“du -sh /srv/www/*”发现nginx log文件占用了20多G。&lt;IMG src=&quot;/js/HTMLEditor/image/emot/em06.gif&quot;&gt; 
&lt;LI&gt;“tail -n 30 error.log”看下log最近到底报的是什么错，结果全是“24: Too many open files”&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;再来解决：&lt;BR&gt;24: Too many open files&lt;BR&gt;Linux系统对一个进程打开的文件句柄数量的限制，默认只有1024，并发高一点就达到这个限制了。&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;“ulimit -a”可以看到当前的设置open files (-n) 1024 
&lt;LI&gt;编辑“/etc/security/limits.conf”，在末尾加入“* soft nofile 65535”和“* hard nofile 65535” 
&lt;LI&gt;编辑“/etc/nginx/nginx.conf”文件，加入“worker_rlimit_nofile 65535;”&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;搞定，重启nginx，观察几天看看。&lt;IMG src=&quot;/js/HTMLEditor/image/emot/em08.gif&quot;&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/604824718/since2006/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/since2006/~8093926/604824718/6199459/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><pubDate>Thu, 29 Dec 2011 10:12:00 +0800</pubDate><author>hee</author><guid isPermaLink="false">http://since2006.com/blog/resolve-nginx-500-error/</guid><dc:creator>hee</dc:creator><fs:srclink>http://since2006.com/blog/resolve-nginx-500-error/</fs:srclink><fs:srcfeed>http://since2006.com/feed</fs:srcfeed><fs:itemid>feedsky/since2006/~8093926/604824718/6199459</fs:itemid></item><item><title>ssh用户登录提醒功能</title><link>http://item.feedsky.com/~feedsky/since2006/~8093926/604824719/6199459/1/item.html</link><description>&lt;P&gt;有时出于安全考虑，可以添加一个SSH登录提醒功能，当用户登录SSH后收到提醒。&lt;/P&gt;
&lt;P&gt;提醒功能可以通过邮件或其它功能发送，俺使用的是一个iOS使用“&lt;A href=&quot;http://itunes.apple.com/cn/app/id470461410?mt=8&quot; target=_blank&gt;推送信使&lt;/A&gt;”提供了URL回调接口，设置好参数后用curl请求一下，一条报警信息就推送到手机。&lt;/P&gt;&lt;PRE class=&quot;brush: bash tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;user=$USER
ip=${SSH_CLIENT%% *}
date=$(date &quot;+%Y-%m-%d_%H:%M&quot;)
title=&quot;用户$user登录了系统&quot;
content=&quot;时间：${date}%0dIP地址：$ip&quot;
app=&quot;SSH监控&quot;
url=&quot;http://whois.pconline.com.cn/ip.jsp?ip=$ip&quot;

pushMessage() {       
        params=&quot;uid=1&amp;amp;secret=6Y2FN7&amp;amp;app=$app&amp;amp;title=$title&amp;amp;content=$content&amp;amp;slient=1&amp;amp;url=$url&quot;
        url=&quot;http://ipush.me/api-push?$params&quot;
        curl --connect-timeout 3 -m 3 -s $url
}

pushMessage&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/604824719/since2006/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/since2006/~8093926/604824719/6199459/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><pubDate>Sat, 17 Dec 2011 11:58:00 +0800</pubDate><author>hee</author><guid isPermaLink="false">http://since2006.com/blog/ssh-user-login-notification/</guid><dc:creator>hee</dc:creator><fs:srclink>http://since2006.com/blog/ssh-user-login-notification/</fs:srclink><fs:srcfeed>http://since2006.com/feed</fs:srcfeed><fs:itemid>feedsky/since2006/~8093926/604824719/6199459</fs:itemid></item><item><title>将VPS数据库自动备份到另一台FTP服务器</title><link>http://item.feedsky.com/~feedsky/since2006/~8093926/604824720/6199459/1/item.html</link><description>&lt;P&gt;现在大部分VPS都是Unmanaged的，虽然都宣称做了RAID10但在论坛上偶尔还是有看到数据丢失的事情，更多的情况是碰到不符合VPS商的服务条款而被关闭了帐号没及时备份造成的。&lt;/P&gt;
&lt;P&gt;正好有一个15刀/年的VPS，由于拿来放网站线路经常抽风所以一直空在那里，现在可以派上用场了。&lt;IMG src=&quot;/js/HTMLEditor/image/emot/em14.gif&quot;&gt;&lt;/P&gt;
&lt;P&gt;首先确保正式服务器上安装了lftp（ftp命令行客户端），备份服务器上安装了ftp服务端（任意）。&lt;/P&gt;
&lt;P&gt;第一次折腾bash，现学现卖，功能是备份mysql中一个或多个数据库并打包传送到远程ftp服务器中去：&lt;/P&gt;&lt;PRE class=&quot;brush: bash tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;#!/bin/bash

# --------------- 配置项 -------------
# 数据库用户
DB_USER=&quot;root&quot;
# 数据库密码
DB_PASSWD=&quot;123456&quot;
# 要备份的数据库名，多个用空格分开
DB_BACKUP_DATABASE_LIST=&quot;db1 db2&quot;
# 备份文件本地存放路径
DB_BACKUP_DIR=&quot;/home/hee/backup/db&quot;
# 远程FTP配置信息，格式：用户名:密码@服务器地址
REMOTE_FTP_DSN=&quot;user:passwd@ip&quot;

# ------------ 以下内容无需编辑 -------------
YYYYMMDD=$(date +%Y-%m-%d)

# -----------------------------------
DB_BACKUP_FILE=&quot;$DB_BACKUP_DIR/$YYYYMMDD.sql.gz&quot;

# -----------------------------------
mkdir -p $DB_BACKUP_DIR
cd $DB_BACKUP_DIR

mysqldump --user=$DB_USER --password=$DB_PASSWD --lock-all-tables --databases $DB_BACKUP_DATABASE_LIST | gzip &amp;gt; $DB_BACKUP_FILE

lftp $REMOTE_FTP_DSN -e &quot;put $DB_BACKUP_FILE;exit;&quot;
&lt;/PRE&gt;
&lt;P&gt;然后设置一个定时任务，按想要的时间定时执行一下就OK了。&lt;/P&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/604824720/since2006/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/since2006/~8093926/604824720/6199459/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><pubDate>Tue, 15 Nov 2011 09:50:00 +0800</pubDate><author>hee</author><guid isPermaLink="false">http://since2006.com/blog/vps-data-backup-to-ftp/</guid><dc:creator>hee</dc:creator><fs:srclink>http://since2006.com/blog/vps-data-backup-to-ftp/</fs:srclink><fs:srcfeed>http://since2006.com/feed</fs:srcfeed><fs:itemid>feedsky/since2006/~8093926/604824720/6199459</fs:itemid></item><item><title>CentOS 5.7安装eAccelerator</title><link>http://item.feedsky.com/~feedsky/since2006/~8093926/604824721/6199459/1/item.html</link><description>&lt;P&gt;&lt;A href=&quot;https://eaccelerator.net/&quot; target=_blank&gt;eAccelerator&lt;/A&gt;是一个免费开源的PHP加速、优化、编译和动态缓存的项目，它可以通过缓存PHP代码编译后的结果来提高PHP脚本的性能，使得一向很复杂和离我们很远的PHP脚本编译问题完全得到解决。通过使用eAccelerator，可以优化你的PHP代码执行速度，降低服务器负载，可以提高PHP应用执行速度最高达10倍。&lt;/P&gt;
&lt;P&gt;eAccelerator通过把经过编译后的PHP代码缓存到共享内存中，并在用户访问的时候直接调用从而起到高效的加速作用。它的效率非常高，从创建共享内存到查找编译后的代码都在非常短的时间内完成，对于不能缓存到共享内存中的文件和代码，eAccelerator还可以把他们缓存到系统磁盘上。&lt;/P&gt;
&lt;P&gt;参照linode安装指南上的方法，默认是没有安装eAccelerator的，得自己把这功能加上。安装前先了解下另一个东东：phpize。&lt;/P&gt;
&lt;P&gt;&lt;A href=&quot;http://php.net/manual/en/install.pecl.phpize.php&quot; target=_blank&gt;phpize&lt;/A&gt;是用来扩展php扩展模块的，通过phpize可以建立php的外挂模块。比如你想在原来编译好的php中加入eAccelerator或者memcached等扩展模块，可以使用phpize。&lt;/P&gt;
&lt;P&gt;基础知识了解完了后，开始安装：&lt;/P&gt;&lt;PRE class=&quot;brush: bash tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;# 安装phpize
yum install php-devel
# 下载eaccelerator
wget http://soft.vpser.net/web/eaccelerator/eaccelerator-0.9.6.1.zip
unzip eaccelerator-0.9.6.1.zip
cd eaccelerator-0.9.6.1
phpize
./configure --enable-eaccelerator=shared --with-php-config=/usr/bin/php-config
make
make install&lt;/PRE&gt;
&lt;P&gt;编辑php.ini：&lt;/P&gt;&lt;PRE class=&quot;brush: plain tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;vi /etc/php.ini

# 在结尾加入
zend_extension=&quot;/usr/lib/php/modules/eaccelerator.so&quot;
eaccelerator.shm_size=&quot;16&quot;
eaccelerator.cache_dir=&quot;/tmp/eaccelerator&quot;
eaccelerator.enable=&quot;1&quot;
eaccelerator.optimizer=&quot;1&quot;
eaccelerator.check_mtime=&quot;1&quot;
eaccelerator.debug=&quot;0&quot;
eaccelerator.filter=&quot;&quot;
eaccelerator.shm_max=&quot;0&quot;
eaccelerator.shm_ttl=&quot;0&quot;
eaccelerator.shm_prune_period=&quot;0&quot;
eaccelerator.shm_only=&quot;0&quot;
eaccelerator.compress=&quot;1&quot;
eaccelerator.compress_level=&quot;9&quot;&lt;/PRE&gt;
&lt;P&gt;创建eAccelerator缓存目录：&lt;/P&gt;&lt;PRE class=&quot;brush: bash tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;mkdir /tmp/eaccelerator
chmod 0777 /tmp/eaccelerator&lt;/PRE&gt;
&lt;P&gt;查看一下phpinfo吧 :-)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/604824721/since2006/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/since2006/~8093926/604824721/6199459/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><pubDate>Fri, 11 Nov 2011 20:52:00 +0800</pubDate><author>hee</author><guid isPermaLink="false">http://since2006.com/blog/centos5-install-eaccelerator/</guid><dc:creator>hee</dc:creator><fs:srclink>http://since2006.com/blog/centos5-install-eaccelerator/</fs:srclink><fs:srcfeed>http://since2006.com/feed</fs:srcfeed><fs:itemid>feedsky/since2006/~8093926/604824721/6199459</fs:itemid></item><item><title>一些常用VPS维护使用命令</title><link>http://item.feedsky.com/~feedsky/since2006/~8093926/604824722/6199459/1/item.html</link><description>&lt;P&gt;记忆力越来越差了&lt;IMG src=&quot;/js/HTMLEditor/image/emot/em15.gif&quot;&gt;。偶尔维护使用一下，过几天就忘了。&lt;/P&gt;
&lt;P&gt;显示系统进程资源占用状况&lt;/P&gt;&lt;PRE class=&quot;brush: bash tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;[hee@TokyoHot ~]$ top
# M键：按内存使用大小排序（从大到小）
# 1键：显示每个具体CPU核心使用率情况&lt;/PRE&gt;
&lt;P&gt;各VPS间通过SSH互相复制文件（无需FTP、WEB服务器）&lt;/P&gt;&lt;PRE class=&quot;brush: bash tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;# 获取远程服务器上的文件，-P为远程服务器ssh端口
scp -P 22 root@vps.since2006.com:/root/backup.tar.gz /home/backup.tar.gz

# 获取远程服务器上的目录
scp -P 22 -r root@vps.since2006.com:/root/backups/ /home/backups/&lt;/PRE&gt;
&lt;P&gt;vi中字符串替换功能&lt;/P&gt;&lt;PRE class=&quot;brush: bash tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;# 使用:s命令进行查找替换

# 例1:将内容中第一次出现的abc替换成123
:%s/abc/123

# 例1:将内容中所有abc替换成123
:%s/abc/123/g&lt;/PRE&gt;
&lt;P&gt;批量更改目录下文件所属组及文件权限&lt;/P&gt;&lt;PRE class=&quot;brush: bash tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;# 更改目录及目录下所有文件所属用户组
chgrp -R groupName directoryName

# 更改目录及目录下所有文件组用户权限可写
chmod -R g+w directoryName&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/604824722/since2006/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/since2006/~8093926/604824722/6199459/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><pubDate>Wed, 09 Nov 2011 21:17:00 +0800</pubDate><author>hee</author><guid isPermaLink="false">http://since2006.com/blog/linux-general-command/</guid><dc:creator>hee</dc:creator><fs:srclink>http://since2006.com/blog/linux-general-command/</fs:srclink><fs:srcfeed>http://since2006.com/feed</fs:srcfeed><fs:itemid>feedsky/since2006/~8093926/604824722/6199459</fs:itemid></item><item><title>KVM VPS CentOS 5.7安装PPTP VPN</title><link>http://item.feedsky.com/~feedsky/since2006/~8093926/604824723/6199459/1/item.html</link><description>&lt;P&gt;折腾了N天，结果发现是测试网络环境下是禁用PPTP VPN的，在家试了下完全没问题。 &lt;/P&gt;
&lt;P&gt;没有使用网上的一键安装包，一键安装包中大多有重复安装过一些不必要的装的组件，如MPPE。&lt;/P&gt;
&lt;BLOCKQUOTE&gt;Kernel version 2.6.15 or above has MPPE built-in which is required for MSCHAPv2.&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR&gt;1、确定内核是否支持MPPE：&lt;/P&gt;&lt;PRE class=&quot;brush: plain tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;modprobe ppp-compress-18 &amp;amp;&amp;amp; echo ok&lt;/PRE&gt;
&lt;P&gt;如果显示“ok”表明内核已经具备了mppe支持。&lt;/P&gt;
&lt;P&gt;2、然后检查PPP是否支持MPPE：&lt;/P&gt;&lt;PRE class=&quot;brush: plain tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;strings '/usr/sbin/pppd' |grep -i mppe | wc –l&lt;/PRE&gt;
&lt;P&gt;如果以上命令输出为“0”则表示不支持；输出为“30”或更大的数字就表示支持。&lt;/P&gt;
&lt;P&gt;3、安装iptables&lt;/P&gt;&lt;PRE class=&quot;brush: bash tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;yum install iptables&lt;/PRE&gt;
&lt;P&gt;4、安装pptp：&lt;/P&gt;&lt;PRE class=&quot;brush: plain tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;# 32位系统使用
rpm -ivh http://poptop.sourceforge.net/yum/stable/packages/pptpd-1.3.4-2.rhel5.i386.rpm

# 64位系统使用
rpm -ivh http://poptop.sourceforge.net/yum/stable/packages/pptpd-1.3.4-2.rhel5.x86_64.rpm&lt;/PRE&gt;
&lt;P&gt;5、配置pptp：&lt;/P&gt;&lt;PRE class=&quot;brush: bash tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;vi /etc/pptpd.conf&lt;/PRE&gt;去掉下面代码前的#号：&lt;PRE class=&quot;brush: plain tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;localip 192.168.0.1
remoteip 192.168.0.234-238,192.168.0.245&lt;/PRE&gt;
&lt;P&gt;6、编辑options.pptpd&lt;/P&gt;&lt;PRE class=&quot;brush: bash tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;vi /etc/ppp/options.pptpd&lt;/PRE&gt;
&lt;P&gt;
&lt;P&gt;去掉ms-dns前面的#，并修改成如下字段：&lt;/P&gt;&lt;PRE class=&quot;brush: plain tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;ms-dns 8.8.8.8
ms-dns 8.8.4.4&lt;/PRE&gt;
&lt;P&gt;7、创建vpn帐号&lt;/P&gt;&lt;PRE class=&quot;brush: bash tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;vi /etc/ppp/chap-secrets&lt;/PRE&gt;
&lt;P&gt;内容分别为：用户名 pptpd 密码 IP范围&lt;/P&gt;&lt;PRE class=&quot;brush: plain tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;kaede pptpd 123456 *&lt;/PRE&gt;8、修改内核设置，使其支持转发&lt;PRE class=&quot;brush: bash tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;vi /etc/sysctl.conf&lt;/PRE&gt;将文本中的相似内容替换为：&lt;PRE class=&quot;brush: plain tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;net.ipv4.ip_forward=1
#net.ipv4.tcp_syncookies=1&lt;/PRE&gt;9、保存退出，并执行下面的命令来生效：&lt;PRE class=&quot;brush: bash tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;sysctl -p&lt;/PRE&gt;10、添加iptables转发规则：&lt;PRE class=&quot;brush: plain tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;# xen 适用
# kvm 适用
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE&lt;/PRE&gt;
&lt;P&gt;11、保存重启：&lt;/P&gt;&lt;PRE class=&quot;brush: bash tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;# 保存iptables规则
/etc/init.d/iptables save

# 重启iptables
/etc/init.d/iptables restart

# 重启pptp服务
/etc/init.d/pptpd restart

# 设置开机自动运行服务
chkconfig pptpd on
chkconfig iptables on&lt;/PRE&gt;12、测试 :-)&lt;img src=&quot;http://www1.feedsky.com/t1/604824723/since2006/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/since2006/~8093926/604824723/6199459/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><pubDate>Tue, 08 Nov 2011 21:08:00 +0800</pubDate><author>hee</author><guid isPermaLink="false">http://since2006.com/blog/kvm-vps-install-pptp-vpn/</guid><dc:creator>hee</dc:creator><fs:srclink>http://since2006.com/blog/kvm-vps-install-pptp-vpn/</fs:srclink><fs:srcfeed>http://since2006.com/feed</fs:srcfeed><fs:itemid>feedsky/since2006/~8093926/604824723/6199459</fs:itemid></item><item><title>VPS LEMP优化配置</title><link>http://item.feedsky.com/~feedsky/since2006/~8093926/604824724/6199459/1/item.html</link><description>&lt;P&gt;&lt;A href=&quot;http://library.linode.com/lemp-guides/centos-5&quot; target=_blank&gt;Linode LEMP安装指南&lt;/A&gt;中安装的LEMP只是一个能用的状态，正式使用还需要配置一些参数。&lt;/P&gt;
&lt;P&gt;vi /etc/nginx/nginx.conf&lt;/P&gt;&lt;PRE class=&quot;brush: plain tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;    events {
        # linux 2.6版本以后使用epoll性能会提升较大
        use epoll;
    }
    
    # 开启gzip压缩
    gzip on;
    gzip_min_length 1k;
    gzip_buffers 4 16k;
    gzip_http_version 1.0;
    gzip_comp_level 2;
    gzip_types text/plain application/x-javascript text/css application/xml;
    gzip_vary on;
    
    # php fastcgi相关配置
    fastcgi_connect_timeout 300;
    fastcgi_send_timeout 300;
    fastcgi_read_timeout 300;
    fastcgi_buffer_size 128k;
    fastcgi_buffers 8 128k;
    fastcgi_busy_buffers_size 256k;
    fastcgi_temp_file_write_size 256k;
&lt;/PRE&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/604824724/since2006/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/since2006/~8093926/604824724/6199459/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><pubDate>Tue, 08 Nov 2011 20:50:00 +0800</pubDate><author>hee</author><guid isPermaLink="false">http://since2006.com/blog/custom-lemp-config/</guid><dc:creator>hee</dc:creator><fs:srclink>http://since2006.com/blog/custom-lemp-config/</fs:srclink><fs:srcfeed>http://since2006.com/feed</fs:srcfeed><fs:itemid>feedsky/since2006/~8093926/604824724/6199459</fs:itemid></item><item><title>centos安装vsftp</title><link>http://item.feedsky.com/~feedsky/since2006/~8093926/604824725/6199459/1/item.html</link><description>&lt;P&gt;如果vps是个人使用，完全可以没必要装ftp，上传文件可以用winscp搞定。但有时候要帮朋友放个小站而又不希望开放太多的权限时ftp就派上用场了，这次选中的ftp服务器是vsftp，支持虚拟用户，可以限制虚拟用户访问目录，这两个功能正是俺需要的。&lt;/P&gt;
&lt;P&gt;登录FTP有三种方式，匿名登录、本地用户登录和虚拟用户登录。&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;匿名登录：在登录FTP时使用默认的用户名，一般是ftp或anonymous。 
&lt;LI&gt;本地用户登录：使用系统用户登录，在/etc/passwd中。 
&lt;LI&gt;虚拟用户登录：这是FTP专有用户，有两种方式实现虚拟用户，本地数据文件和数据库服务器。&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;虚拟用户登录+本地数据文件正好实现俺要的需求。&lt;/P&gt;
&lt;P&gt;安装vsftp：&lt;/P&gt;&lt;PRE class=&quot;brush: bash tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;[root@TokyoHot ~]# yum install vsftpd&lt;/PRE&gt;
&lt;P&gt;添加虚拟用户：&lt;/P&gt;&lt;PRE class=&quot;brush: bash tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;[root@TokyoHot ~]# vi /etc/vsftpd/vftpuser.txt&lt;/PRE&gt;
&lt;P&gt;内容：&lt;/P&gt;&lt;PRE class=&quot;brush: plain tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;kaede       # 用户名
123456     # kaede的密码
SolaAoi      # 用户名
456789     # SolaAoi的密码&lt;/PRE&gt;
&lt;P&gt;将vftpuser.txt虚拟用户口令文件转换成系统识别的口令认证文件：&lt;BR&gt;如果没有安装db4-utils要先安装一把：&lt;/P&gt;&lt;PRE class=&quot;brush: bash tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;[root@TokyoHot ~]# yum install db4-utils&lt;/PRE&gt;
&lt;P&gt;转换成系统识别的口令认证文件：&lt;/P&gt;&lt;PRE class=&quot;brush: bash tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;[root@TokyoHot ~]# db_load –T –t hash –f /etc/vsftpd/vftpuser.txt /etc/vsftpd/vftpuser.db&lt;/PRE&gt;
&lt;P&gt;编辑vsftpd的PAM认证文件：&lt;/P&gt;&lt;PRE class=&quot;brush: bash tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;[root@TokyoHot ~]# vi /etc/pam.d/vsftpd&lt;/PRE&gt;
&lt;P&gt;将里面其他的都注释掉，添加下面这两行：&lt;/P&gt;&lt;PRE class=&quot;brush: plain tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;auth required /lib/security/pam_userdb.so db=/etc/vsftpd/vftpuser
account required /lib/security/pam_userdb.so db=/etc/vsftpd/vftpuser&lt;/PRE&gt;
&lt;P&gt;配置vsftpd.conf（设置虚拟用户配置项）：&lt;BR&gt;&lt;/P&gt;&lt;PRE class=&quot;brush: bash tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;[root@TokyoHot ~]# vi /etc/vsftpd/vsftpd.conf&lt;/PRE&gt;
&lt;P&gt;内容：&lt;/P&gt;&lt;PRE class=&quot;brush: plain tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;anonymous_enable=NO #禁用匿名用户
guest_enable=YES #开启虚拟用户
guest_username=ftp #FTP虚拟用户对应的系统用户
pam_service_name=vsftpd #PAM认证文件
anon_world_readable_only=NO #开放虚拟用户下载权限
anon_upload_enable=YES #开放虚拟用户上传权限
anon_mkdir_write_enable=YES #开放虚拟用户创建目录的权限
anon_other_write_enable=YES #开放虚拟用户删除和重命名的权限
user_config_dir=/etc/vsftpd/vsftpd_user_conf #具体每个虚拟用户的配置信息存放目录
anon_umask=022 #新建的目录 权限是755，文件的权限是 644&lt;/PRE&gt;
&lt;P&gt;上面配置中的guest_username=ftp，其中ftp是系统中已经存在的用户名，centos默认已经创建了这个用户。&lt;/P&gt;
&lt;P&gt;配置具体某个虚拟用户的信息（文件名和用户名一致）：&lt;/P&gt;&lt;PRE class=&quot;brush: bash tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;[root@TokyoHot ~]# vi /etc/vsftpd/vsftpd_user_conf/kaede&lt;/PRE&gt;
&lt;P&gt;内容：&lt;/P&gt;&lt;PRE class=&quot;brush: plain tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;local_root=/srv/www #限制kaede的访问目录只能是/srv/www目录&lt;/PRE&gt;
&lt;P&gt;配置完成，重启下ftp服务器测试。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/604824725/since2006/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/since2006/~8093926/604824725/6199459/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><pubDate>Thu, 03 Nov 2011 21:20:00 +0800</pubDate><author>hee</author><guid isPermaLink="false">http://since2006.com/blog/centos-install-vsftp/</guid><dc:creator>hee</dc:creator><fs:srclink>http://since2006.com/blog/centos-install-vsftp/</fs:srclink><fs:srcfeed>http://since2006.com/feed</fs:srcfeed><fs:itemid>feedsky/since2006/~8093926/604824725/6199459</fs:itemid></item><item><title>centos安装LEMP</title><link>http://item.feedsky.com/~feedsky/since2006/~8093926/604824726/6199459/1/item.html</link><description>&lt;P&gt;还是先参考linode知识库的安装指南 :-)&lt;/P&gt;
&lt;P&gt;&lt;A href=&quot;http://library.linode.com/lemp-guides/centos-5&quot; target=_blank&gt;http://library.linode.com/lemp-guides/centos-5&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;不过文章中安装php-fastcgi处只将php-fastcgi设置为开机自动启动，而漏了启动php-fastcgi本身了，导致在后面测试php时，nginx一直报&quot;502 Bad Gateway&quot;错处，查找了半天才发现问题。&lt;/P&gt;
&lt;P&gt;启动一下再测试。&lt;BR&gt;#/etc/init.d/php-fastcgi start&lt;/P&gt;
&lt;P&gt;直接使用安装指南中的配置，还会有一些小问题。比如上传文件大于1M多时，Nginx报“Nginx: 413 Request Entity Too Large Error”。&lt;/P&gt;
&lt;P&gt;可以在站点配置的server块下加入：&lt;BR&gt;client_max_body_size 20M; # 设置客户端最大能上传文件大小&lt;/P&gt;
&lt;P&gt;@2011-11-19：参考安装指南中方法安装，php不支持gd库。&lt;/P&gt;
&lt;P&gt;通过下面命令安装即可：&lt;/P&gt;&lt;PRE class=&quot;brush: bash tb-htmleditor-code&quot; name=&quot;CodeHighlighter&quot;&gt;yum install php-gd
/etc/init.d/php-fastcgi restart&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/604824726/since2006/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/since2006/~8093926/604824726/6199459/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><pubDate>Thu, 03 Nov 2011 20:11:00 +0800</pubDate><author>hee</author><guid isPermaLink="false">http://since2006.com/blog/centos-install-lemp/</guid><dc:creator>hee</dc:creator><fs:srclink>http://since2006.com/blog/centos-install-lemp/</fs:srclink><fs:srcfeed>http://since2006.com/feed</fs:srcfeed><fs:itemid>feedsky/since2006/~8093926/604824726/6199459</fs:itemid></item></channel></rss>
