<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[linux 系统维护及程序管理]]></title> 
<link>http://www.6curl.com/index.php</link> 
<description><![CDATA[linux 系统维护及程序管理]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[linux 系统维护及程序管理]]></copyright>
<item>
<link>http://www.6curl.com/post/71/</link>
<title><![CDATA[Mysql Binlog 定期清除脚本]]></title> 
<author>张明辉 &lt;admin@6curl.com&gt;</author>
<category><![CDATA[工作笔记]]></category>
<pubDate>Sun, 05 Sep 2010 05:24:39 +0000</pubDate> 
<guid>http://www.6curl.com/post/71/</guid> 
<description>
<![CDATA[ 
	清除指定的 binlog。<br/><br/>PURGE MASTER LOGS TO ‘mysql-bin.0010′;<br/><br/>该命令将清除 mysql-bin.0010 文件。<br/><br/>3、清除指定日期前的 binlog。<br/><br/>PURGE MASTER LOGS BEFORE ‘2010-08-01 00:00:00′;<br/>#清除2010年8月的binlog<br/><br/>在 contab 中设置：下面语句定期删除7天前的 binlog<br/><br/>0 1 * * *&nbsp;&nbsp;`mysql -uroot -e ‘PURGE MASTER LOGS BEFORE DATE_SUB( NOW( ), INTERVAL 7 DAY);<br/><br/>Tags - <a href="http://www.6curl.com/tags/mysql/" rel="tag">mysql</a> , <a href="http://www.6curl.com/tags/binlog/" rel="tag">binlog</a> , <a href="http://www.6curl.com/tags/backup/" rel="tag">backup</a>
]]>
</description>
</item><item>
<link>http://www.6curl.com/post/70/</link>
<title><![CDATA[Ubuntu 9.1 上配置静态IP地址]]></title> 
<author>张明辉 &lt;admin@6curl.com&gt;</author>
<category><![CDATA[系统监控]]></category>
<pubDate>Thu, 26 Aug 2010 12:33:06 +0000</pubDate> 
<guid>http://www.6curl.com/post/70/</guid> 
<description>
<![CDATA[ 
	今天我的Ubuntu 9.1 系统不能自动获取IP,自己手动设置静态IP和DNS上网<br/>记录如下：<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">root@zhangmh:~# cat /etc/network/interfaces <br/>auto eth0<br/>iface eth0 inet dhcp</div></div><br/>之前是使用DHCP获取IP.现在该为如下：<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">root@zhangmh:~# cat /etc/network/interfaces <br/>auto eth0<br/>iface eth0 inet static<br/>###add zhangmh####<br/>address 192.168.1.27<br/>netmask 255.255.255.0<br/>gateway 192.168.0.9</div></div><br/><br/>最后重启网卡服务<br/>root@zhangmh:~# ifconfig <br/>如下图：<br/><a href="http://www.6curl.com/attachment.php?fid=31" target="_blank"><img src="http://www.6curl.com/attachment.php?fid=31" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/>最后配置DNS<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">root@zhangmh:~# cat /etc/resolv.conf <br/>nameserver 4.2.2.2<br/>nameserver 8.8.8.</div></div>8<br/><br/>完毕！<br/><br/><br/>Tags - <a href="http://www.6curl.com/tags/ubuntu/" rel="tag">ubuntu</a> , <a href="http://www.6curl.com/tags/ifconfig/" rel="tag">ifconfig</a> , <a href="http://www.6curl.com/tags/ip/" rel="tag">ip</a> , <a href="http://www.6curl.com/tags/dns/" rel="tag">dns</a>
]]>
</description>
</item><item>
<link>http://www.6curl.com/lvm-snapshot/</link>
<title><![CDATA[LVM创建快照出错]]></title> 
<author>张明辉 &lt;admin@6curl.com&gt;</author>
<category><![CDATA[工作笔记]]></category>
<pubDate>Tue, 27 Jul 2010 08:19:38 +0000</pubDate> 
<guid>http://www.6curl.com/lvm-snapshot/</guid> 
<description>
<![CDATA[ 
	今天突然接到短信报警,提示我的备份没有成功.....<br/>怎么可能阿！！！！<br/><br/>登上服务器一看,备份系统创建LVM 快照时出现了错误,提示：<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">Insufficient Free Extents for a Logical Volume</div></div><br/>于是查看问题：<br/>[root@backup /]# vdisplay <br/>&nbsp;&nbsp;--- Physical volume ---<br/>&nbsp;&nbsp;PV Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /dev/sda2<br/>&nbsp;&nbsp;VG Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VolGroup01<br/>&nbsp;&nbsp;PV Size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 558.27 GB / not usable 24.40 MB<br/>&nbsp;&nbsp;......<br/>&nbsp;&nbsp;......<br/>&nbsp;&nbsp;<strong>Free PE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0</strong><br/>&nbsp;&nbsp;Allocated PE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;17864<br/>&nbsp;&nbsp;PV UUID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vZilnx-xc6i-0zuE-O5Uf-bFYh-Tgnj-HtpVqU<br/><br/>没空间了?<br/><br/>[root@backup /]# vgs -o +vg_free_count,vg_extent_count<br/>&nbsp;&nbsp;VG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #PV #LV #SN Attr&nbsp;&nbsp; VSize&nbsp;&nbsp; VFree Free #Ext <br/>&nbsp;&nbsp;VolGroup01&nbsp;&nbsp; 1&nbsp;&nbsp; 3&nbsp;&nbsp; 0 wz--n- 558.25G&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp; 0 17864<br/><br/>郁闷?<br/><br/><span style="color: #DC143C;">注意:我的LVM上是通过建立LVM快照备份的</span><br/>所以出现上面的错误(Insufficient Free Extents for a Logical Volume)是正常的.<br/><br/>问题点找到了,剩下的就是添加硬盘了<br/>&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;使用一个物理磁盘创建一个分区。建议将分区类型改为 0x8e（Linux LVM）使用 pvcreate 对物理磁盘进行初始化：pvcreate /dev/hda8。<br/>&nbsp;&nbsp;&nbsp;&nbsp;* 然后，使用 vgextend 将它添加到现有的 VG 中：vgextend VolGroup01 /dev/hda8。<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/><strong>Note:</strong><br/>因为我只想增加VG的大小,以便能使用快照.至于PV的扩充,不再我的考虑范围内.<br/><strong>参考:</strong><br/>扩展PV,可以使用 lvextend 扩展逻辑卷了：lvextend -L 8G /dev/VolGroup01/data。这个命令将 /dev/VolGroup01/data LV 的大小扩展到 8GB。<br/>lvextend 有一些有用的参数：<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;* 如果希望让 LV 增加 5GB，那么可以使用 -L +5G。<br/>&nbsp;&nbsp;&nbsp;&nbsp;* 可以指定扩展部分的位置（也就是，用哪些 PV 提供新的空间）；只需将希望使用的 PV 附加在命令后面。<br/>&nbsp;&nbsp;&nbsp;&nbsp;* 还可以以 PE 为单位指定绝对/相对扩展大</div></div><br/><br/>Tags - <a href="http://www.6curl.com/tags/insufficient/" rel="tag">insufficient</a> , <a href="http://www.6curl.com/tags/free/" rel="tag">free</a> , <a href="http://www.6curl.com/tags/extents/" rel="tag">extents</a> , <a href="http://www.6curl.com/tags/for/" rel="tag">for</a> , <a href="http://www.6curl.com/tags/a/" rel="tag">a</a> , <a href="http://www.6curl.com/tags/logical/" rel="tag">logical</a> , <a href="http://www.6curl.com/tags/volume/" rel="tag">volume</a> , <a href="http://www.6curl.com/tags/lvm/" rel="tag">lvm</a>
]]>
</description>
</item><item>
<link>http://www.6curl.com/post/67/</link>
<title><![CDATA[mysql4 通过mysql5认证]]></title> 
<author>张明辉 &lt;admin@6curl.com&gt;</author>
<category><![CDATA[系统监控]]></category>
<pubDate>Mon, 19 Jul 2010 06:23:43 +0000</pubDate> 
<guid>http://www.6curl.com/post/67/</guid> 
<description>
<![CDATA[ 
	因为线上存在mysql版本的差异,因此经常需要mysql4从mysql5 server 上认证去拿资料<br/>因此需要在mysql5上授权mysql4客户端。<br/><br/>方法如下：<br/><br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>mysql> GRANT SELECT ON somedatabase.sometables TO 'some_user'@'some_hosts' identified by 'password';<br/>mysql> update mysql.user set PassWord = OLD_PASSWORD('newpassword')<br/>&nbsp;&nbsp;&nbsp;&nbsp;-> where Host = 'some_host' and user = 'some_user';<br/>mysql> flush privileges;</div></div><br/><br/><br/><br/>Tags - <a href="http://www.6curl.com/tags/mysql/" rel="tag">mysql</a> , <a href="http://www.6curl.com/tags/mysql4/" rel="tag">mysql4</a> , <a href="http://www.6curl.com/tags/mysql5/" rel="tag">mysql5</a>
]]>
</description>
</item><item>
<link>http://www.6curl.com/post/65/</link>
<title><![CDATA[linux sort 使用]]></title> 
<author>张明辉 &lt;admin@6curl.com&gt;</author>
<category><![CDATA[工作笔记]]></category>
<pubDate>Fri, 16 Jul 2010 09:54:08 +0000</pubDate> 
<guid>http://www.6curl.com/post/65/</guid> 
<description>
<![CDATA[ 
	最近使用linux shell 处理文件.这里介绍两个命令:sotr和uniq。<br/>简单举例：<br/><br/>1: 删除交集,不同的部分放到一个新文件中。<br/>cat list.txt list.txt.old &#124; sort &#124; uniq -u > list.txt.new<br/> <br/>2: 取出两个文件的并集,重复的行只保留一份.<br/>cat file1 file2 &#124; sort &#124; uniq > file3<br/><br/>3: 取出两个文件的交集,只留下同时存在于两个文件中的文件.<br/>cat file1 file2 &#124; sort &#124; uniq -d >file3<br/>Tags - <a href="http://www.6curl.com/tags/linux/" rel="tag">linux</a> , <a href="http://www.6curl.com/tags/sort/" rel="tag">sort</a> , <a href="http://www.6curl.com/tags/uniq/" rel="tag">uniq</a> , <a href="http://www.6curl.com/tags/shell/" rel="tag">shell</a>
]]>
</description>
</item><item>
<link>http://www.6curl.com/post/64/</link>
<title><![CDATA[mysql 之 prompt 解决登录环境设置]]></title> 
<author>张明辉 &lt;admin@6curl.com&gt;</author>
<category><![CDATA[数据库配置]]></category>
<pubDate>Wed, 07 Jul 2010 05:09:37 +0000</pubDate> 
<guid>http://www.6curl.com/post/64/</guid> 
<description>
<![CDATA[ 
	最近经常需要登录mysql数据库,操作时间一长就不知道自己在那个库里,特别不方便,如果能向Linux登录窗口一样设置就好了！<br/>还好,Mysql中有个prompt可以设置登录环境变量<br/>如下效果:<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">[root@node2 data]# /opt/app/mysql4/bin/mysql<br/>Welcome to the MySQL monitor.&nbsp;&nbsp;Commands end with ; or &#92;g.<br/>Your MySQL connection id is 1 to server version: 4.0.27-hi4<br/><br/>Type 'help;' or '&#92;h' for help. Type '&#92;c' to clear the buffer.<br/><br/><strong>root@localhost:mysql.sock[(none)] 11:55:18</strong>>use mysql;<br/>Database changed<br/><strong>root@localhost:mysql.sock[mysql] 11:55:27</strong>>&#92;q<br/>Bye</div></div><br/>实现上面的效果可以编辑my.cnf文件,添加:<br/><br/>[mysql]<br/>prompt=&#92;&#92;U:&#92;&#92;p[&#92;d] &#92;&#92;R:&#92;&#92;m:&#92;&#92;s><br/><br/><em><br/>&#92;u:连接用户<br/><br/>&#92;h:连接主机<br/><br/>&#92;d:连接数据库<br/><br/>&#92;r:&#92;m:&#92;s:显示当前时间</em><br/><br/>参考:<a href="http://www.himysql.com/mysql/mysql-prompt-customize.html#more-65" target="_blank">http://www.himysql.com/mysql/mysql-prompt-customize.html#more-65</a><br/><br/>Tags - <a href="http://www.6curl.com/tags/prompt/" rel="tag">prompt</a> , <a href="http://www.6curl.com/tags/mysql/" rel="tag">mysql</a> , <a href="http://www.6curl.com/tags/path/" rel="tag">path</a>
]]>
</description>
</item><item>
<link>http://www.6curl.com/apache-mod_layout/</link>
<title><![CDATA[apache-mod_layout的使用 [原创]]]></title> 
<author>张明辉 &lt;admin@6curl.com&gt;</author>
<category><![CDATA[工作笔记]]></category>
<pubDate>Thu, 17 Jun 2010 09:07:46 +0000</pubDate> 
<guid>http://www.6curl.com/apache-mod_layout/</guid> 
<description>
<![CDATA[ 
	<strong>什么是SSI ?<br/>SSI是嵌入HTML页面中的指令，在页面被提供时由服务器进行运算，以对现有HTML页面增加动态生成的内容，而无须通过CGI程序提供其整个页面，或者使用其他动态技术。<br/>至于什么时候应当用SSI ，而什么时候应当用某些程序生成整个页面，取决于页面中有多少内容是静态的，又有多少内容需要在每次页面被提供时重新计算。SSI是一种增加小段动态信息的好方法，比如当前时间。如果你的页面大部分内容是在被提供时动态生成的，那就要另找方案了.</strong><br/><br/>以上是apache 官方的解释,而在apache 里面的实现就是通过mod_include模块实现.要使服务器允许SSI,必须在httpd.conf或.htaccess文件中有如下配置：<br/><br/>AddType text/html .shtml<br/>AddOutputFilter INCLUDES .shtml&nbsp;&nbsp;&nbsp;&nbsp;####声明那些文件后缀使用ssi<br/>Options +Includes&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; ####启用ssi指令<br/><br/>首先我们分析下ssi原理和设置:<br/>&nbsp;&nbsp;&nbsp;&nbsp; 1:全文式的搜索文件内容来寻找源码的Include标签,消耗大量cpu资源<br/>&nbsp;&nbsp;&nbsp;&nbsp; 2:而大量的html文件是不经常更改的,所以无法随意的修改文件后缀(shml),尽管我可以更改如下：<br/>&nbsp;&nbsp;&nbsp;&nbsp; AddType text/html .shtml html<br/>&nbsp;&nbsp;&nbsp;&nbsp; AddOutputFilter INCLUDES .shtml html<br/>&nbsp;&nbsp;&nbsp;&nbsp; 但是我其他没有include标签的html似乎很无辜!<br/>&nbsp;&nbsp;&nbsp;&nbsp; 3:通过设置"XBitHack on“似乎能解决一些问题,但也仅仅是杯水车薪。<br/>&nbsp;&nbsp;&nbsp;&nbsp; 当然ssi对系统性能的影响完全大于我们对他的需求<br/>&nbsp;&nbsp;&nbsp;&nbsp; 今天的web不是几年前的web那么简单,不是几个简单的html就能搞定的事,大量内容的发布似拖动了整个页面的更新.往往这些更新只是局部的,这样的开销开销似乎很不合算.SSi就是满足了我们这点.<br/>那有没有更简单的方式实现服务器端包含呢？<br/>答案是有的！<br/><br/><strong>今天我们介绍通过apache的第三方模块实现对现有HTML文档增加动态内容的方法<br/>mod_layout<br/>mod_layout(<a href="http://tangent.org/362/mod_layout.html)" target="_blank">http://tangent.org/362/mod_layout.html)</a>是一个Apache模块,它支持html网页内容自动插入来自其他URL或者文件输出的内容来子作为指定网页的页眉和页脚。目前支持mod_perl,PHP 和 Apache JServ.和几乎任何类型的处理程序</strong>。<br/><br/>据我了解sina就是使用mod_layout！<br/><br/>[root@node2 extra]# curl --head <a href="http://www.sina.com.cn" target="_blank">www.sina.com.cn</a><br/>HTTP/1.0 200 OK<br/>Date: Thu, 17 Jun 2010 08:22:02 GMT<br/>Server: Apache/2.0.54 (Unix)<br/>Last-Modified: Thu, 17 Jun 2010 08:21:00 GMT<br/>Accept-Ranges: bytes<br/><strong>X-Powered-By: mod_xlayout_jh/0.0.1vhs.markIII.remix</strong><br/>Cache-Control: max-age=60<br/>Expires: Thu, 17 Jun 2010 08:23:02 GMT<br/>Vary: Accept-Encoding<br/>X-UA-Compatible: IE=EmulateIE7<br/>Content-Type: text/html<br/>Age: 48<br/>Content-Length: 555586<br/>X-Cache: HIT from sh201-20.sina.com.cn<br/>Connection: close<br/><br/>[root@node2 extra]# curl --head <a href="http://sh.house.sina.com.cn/" target="_blank">http://sh.house.sina.com.cn/</a><br/>HTTP/1.1 200 OK<br/>Date: Thu, 17 Jun 2010 08:29:36 GMT<br/>Server: Apache/2.2.6 (Unix)<br/>Last-Modified: Thu, 17 Jun 2010 08:18:35 GMT<br/>Accept-Ranges: bytes<br/>Cache-Control: max-age=1800<br/>Expires: Thu, 17 Jun 2010 08:59:36 GMT<br/><strong>X-Powered-By: ModLayout/5.1</strong><br/>Vary: Accept-Encoding<br/>Connection: close<br/>Content-Type: text/html<br/><br/><strong>INSTALL步骤如下</strong>:<br/>Red Hat Enterprise Linux Server release 5.4 (Tikanga)<br/>Server version: Apache/2.2.11 (Unix)<br/>我的apache安装在/opt/app/apache(根据自己的编译环境选择)<br/><br/><strong>软件下载</strong>:<br/>wget <a href="http://fetus.k-hsu.net/document/webmaster/diary2/binary/20060315_modlayout.tar.gz" target="_blank">http://fetus.k-hsu.net/document/webmaster/diary2/binary/20060315_modlayout.tar.gz</a><br/>apache的安装省略！<br/><br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">[root@node2 httpd-2.2.14]# tar -zxvf 20060315_modlayout.tar.gz<br/>mod_layout/<br/>mod_layout/mod_layout-4.0.1a/<br/>mod_layout/mod_layout-4.0.1a/Makefile<br/>.................<br/>.................<br/>mod_layout/mod_layout-4.0.1a/ChangeLog<br/>mod_layout/mod_layout-4.0.1a/modules.mk<br/>mod_layout/liblayout.so<br/>[root@node2 httpd-2.2.14]# cd mod_layout/<br/>[root@node2 mod_layout]# ls<br/>liblayout.so&nbsp;&nbsp;mod_layout-4.0.1a<br/>[root@node2 mod_layout]# cd mod_layout-4.0.1a/<br/>[root@node2 mod_layout-4.0.1a]# ls<br/>ChangeLog&nbsp;&nbsp;&nbsp;&nbsp; layout.c&nbsp;&nbsp; layout.o&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Makefile&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mod_layout.h&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mod_layout.lo&nbsp;&nbsp; modules.mk&nbsp;&nbsp;&nbsp;&nbsp; proto.h&nbsp;&nbsp;&nbsp;&nbsp;utility.la&nbsp;&nbsp;utility.slo<br/>directives.h&nbsp;&nbsp;layout.la&nbsp;&nbsp;layout.slo&nbsp;&nbsp;&nbsp;&nbsp;mod_layout.c&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mod_layout.h.orig&nbsp;&nbsp;mod_layout.o&nbsp;&nbsp;&nbsp;&nbsp;patches&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;README&nbsp;&nbsp;&nbsp;&nbsp; utility.lo&nbsp;&nbsp;version.h<br/>INSTALL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; layout.lo&nbsp;&nbsp;liblayout.la&nbsp;&nbsp;mod_layout.c.orig&nbsp;&nbsp;mod_layout.la&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mod_layout.slo&nbsp;&nbsp;protobuild.pl&nbsp;&nbsp;utility.c&nbsp;&nbsp;utility.o<br/>[root@node2 mod_layout-4.0.1a]# vi Makefile<br/><textarea name="code" class="php" rows="15" cols="100">
##
##&nbsp;&nbsp;Makefile -- Build procedure for mod_layout Apache module
##
builddir=$(shell pwd)
top_srcdir=/etc/httpd ----->/opt/app/apache2(指定为apache的安装路径)
top_builddir=/etc/httpd ----->/opt/app/apache2(指定为apache安装路径)
include /usr/lib/httpd/build/special.mk /opt/app/apache2/build/special.mk(同上)

#&nbsp;&nbsp; the used tools
APXS=/usr/sbin/apxs ------>/opt/app/apache2/bin/apxs (apxs 安装路径)
APACHECTL=/etc/init.d/httpd
CC=`$(APXS) -q CC`
INC=-I`$(APXS) -q INCLUDEDIR` `$(APXS) -q CFLAGS`&nbsp;&nbsp;#-DLAYOUT_FILEOWNER_NAME
LD_SHLIB=`apxs -q LDFLAGS_SHLIB`
VERSION = 4.0.1a
DISTNAME = mod_layout
DISTVNAME = $(DISTNAME)-$(VERSION)
</textarea><br/>修改完成后保存退出<br/>[root@node2 mod_layout-4.0.1a]# <strong>make</strong><br/>/opt/app/apache2/bin/apxs -c mod_layout.c <br/>//opt/app/apache2/build/libtool --silent --mode=compile gcc -prefer-pic&nbsp;&nbsp; -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -g -O2 -pthread -I//opt/app/apache2/include&nbsp;&nbsp;-I//opt/app/apache2/include&nbsp;&nbsp; -I//opt/app/apache2/include&nbsp;&nbsp; -c -o mod_layout.lo mod_layout.c && touch mod_layout.slo<br/>//opt/app/apache2/build/libtool --silent --mode=link gcc -o mod_layout.la&nbsp;&nbsp;-rpath //opt/app/apache2/modules -module -avoid-version&nbsp;&nbsp;&nbsp;&nbsp;mod_layout.lo<br/>/opt/app/apache2/bin/apxs -c utility.c<br/>//opt/app/apache2/build/libtool --silent --mode=compile gcc -prefer-pic&nbsp;&nbsp; -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -g -O2 -pthread -I//opt/app/apache2/include&nbsp;&nbsp;-I//opt/app/apache2/include&nbsp;&nbsp; -I//opt/app/apache2/include&nbsp;&nbsp; -c -o utility.lo utility.c && touch utility.slo<br/>//opt/app/apache2/build/libtool --silent --mode=link gcc -o utility.la&nbsp;&nbsp;-rpath //opt/app/apache2/modules -module -avoid-version&nbsp;&nbsp;&nbsp;&nbsp;utility.lo<br/>/opt/app/apache2/bin/apxs -c layout.c<br/>//opt/app/apache2/build/libtool --silent --mode=compile gcc -prefer-pic&nbsp;&nbsp; -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -g -O2 -pthread -I//opt/app/apache2/include&nbsp;&nbsp;-I//opt/app/apache2/include&nbsp;&nbsp; -I//opt/app/apache2/include&nbsp;&nbsp; -c -o layout.lo layout.c && touch layout.slo<br/>//opt/app/apache2/build/libtool --silent --mode=link gcc -o layout.la&nbsp;&nbsp;-rpath //opt/app/apache2/modules -module -avoid-version&nbsp;&nbsp;&nbsp;&nbsp;layout.lo<br/>/opt/app/apache2/bin/apxs -o liblayout.la -c mod_layout.lo utility.lo layout.lo<br/>//opt/app/apache2/build/libtool --silent --mode=link gcc -o liblayout.la&nbsp;&nbsp;-rpath //opt/app/apache2/modules -module -avoid-version&nbsp;&nbsp;&nbsp;&nbsp;mod_layout.lo utility.lo layout.lo<br/>#/opt/app/apache2/bin/apxs -c -o liblayout mod_layout.lo utility.lo layout.lo<br/>#/opt/app/apache2/bin/apxs -i -a mod_layout.la<br/>[root@node2 mod_layout-4.0.1a]# <strong>make install</strong><br/>make[1]: Entering directory `/opt/app/mod_layout/mod_layout-4.0.1a'<br/>//opt/app/apache2/build/libtool --silent --mode=install cp mod_layout.la //opt/app/apache2/modules/<br/>make[1]: Leaving directory `/opt/app/mod_layout/mod_layout-4.0.1a'<br/>..............<br/>...........<br/>.......<br/>chmod 755 //opt/app/apache2/modules/liblayout.so<br/>+--------------------------------------------------------+<br/>&#124; All done.&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#124;<br/>&#124;&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;&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;&#124;<br/>&#124; You will need to add the directive:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#124;<br/>&#124; LoadModule layout_module modules/liblayout.so&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#124;<br/>&#124;&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;&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;&#124;<br/>&#124; So that you can begin to use mod_layout.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#124;<br/>&#124;&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;&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;&#124;<br/>&#124; Thanks for installing mod_layout.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#124;<br/>+--------------------------------------------------------+</div></div><br/>出现以上,证明安装没有问题<br/>确保http.conf 配置文件里面有这行:<br/><br/>LoadModule layout_module modules/liblayout.so<br/><br/>#############################################################<br/> 建立一个虚拟主机测试:<br/><textarea name="code" class="php" rows="15" cols="100">
<virtualHost *:80>
<Directory "/var/www/html/">
&nbsp;&nbsp;&nbsp;&nbsp;Options Indexes FollowSymLinks
&nbsp;&nbsp;&nbsp;&nbsp;AllowOverride None
&nbsp;&nbsp;&nbsp;&nbsp;Order allow,deny
&nbsp;&nbsp;&nbsp;&nbsp;Allow from all
</Directory>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DocumentRoot /var/www/html
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AddOutputFilter LAYOUT html (定义什么文件类型需要LAYOUT模块处理)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AddOutputFilter LAYOUT htm
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AddOutputFilter LAYOUT cgi
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#AddOutputFilter LAYOUT php
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LayoutHeader /var/www/html/header.html
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LayoutFooter /var/www/html/footer.html
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DirectoryIndex index.html index.html.var index.php
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ServerName <a href="http://www.abc.com" target="_blank">www.abc.com</a>
</VirtualHost>
</textarea><br/>###############################################################<br/>[root@node2 mod_layout-4.0.1a] echo "header" >　/var/www/html/header.html<br/>[root@node2 mod_layout-4.0.1a] echo "footer" >　/var/www/html/footer.html<br/><br/>完成！<br/>Tags - <a href="http://www.6curl.com/tags/apache/" rel="tag">apache</a> , <a href="http://www.6curl.com/tags/ssi/" rel="tag">ssi</a> , <a href="http://www.6curl.com/tags/mod_layout/" rel="tag">mod layout</a>
]]>
</description>
</item><item>
<link>http://www.6curl.com/post/61/</link>
<title><![CDATA[squid 3.0 文件数导致当机]]></title> 
<author>张明辉 &lt;admin@6curl.com&gt;</author>
<category><![CDATA[工作笔记]]></category>
<pubDate>Mon, 07 Jun 2010 11:31:01 +0000</pubDate> 
<guid>http://www.6curl.com/post/61/</guid> 
<description>
<![CDATA[ 
	今天接到客服打的电话,说公司财经网站出现了问题，上监控一看,是squid挂掉了,因为我前段做了LVS,所以短时间影响不大！<br/>查看cache.log<br/><br/>client_side.cc(2843) WARNING! Your cache is running out of filedescriptors<br/><br/>根据经验可能是文件描述符的数量使用完了<br/>郁闷!<br/>echo “132096″ > /proc/sys/fs/file-max"<br/>调整后,重启Squid ,OK！<br/>系统默认的设置一般是如下：<br/><br/>cat /proc/sys/fs/file-nr<br/>7125&nbsp;&nbsp;0&nbsp;&nbsp;767196<br/><br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">7125：总共打开的文件描述符的数量（从系统开机开始算, 所有打开的文件描述符的数量）<br/>0：总共的空闲的文件描述符的数量<br/>767196：最大能打开的文件描述符的数量</div></div><br/><br/>PS1:<strong>尤其是针对大并发大连接数Web,squid等应用服务器,还是调大的保险!!</strong><br/><br/><br/><br/>Tags - <a href="http://www.6curl.com/tags/squid/" rel="tag">squid</a> , <a href="http://www.6curl.com/tags/web/" rel="tag">web</a> , <a href="http://www.6curl.com/tags/apache/" rel="tag">apache</a>
]]>
</description>
</item><item>
<link>http://www.6curl.com/post/60/</link>
<title><![CDATA[普通用户编译RPM包]]></title> 
<author>张明辉 &lt;admin@6curl.com&gt;</author>
<category><![CDATA[RedHat 系统]]></category>
<pubDate>Tue, 01 Jun 2010 06:57:12 +0000</pubDate> 
<guid>http://www.6curl.com/post/60/</guid> 
<description>
<![CDATA[ 
	&nbsp;&nbsp; 1. 创建一个普通用户，并设置密码：<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# useradd -m -s /bin/bash zhangmh<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# passwd zhangmh<br/><br/>&nbsp;&nbsp; 2. 切换到该用户：<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# su - zhangmh<br/><br/>&nbsp;&nbsp; 3. 创建必须的目录，并设置变量：<br/><br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ mkdir $HOME/rpm<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ mkdir $HOME/rpm/SOURCES<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ mkdir $HOME/rpm/SPECS<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ mkdir $HOME/rpm/BUILD<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ mkdir $HOME/rpm/SRPMS<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ mkdir $HOME/rpm/RPMS<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ mkdir $HOME/rpm/RPMS/i386<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ echo "%_topdir $HOME/rpm" >> $HOME/.rpmmacros</div></div><br/><br/><br/>Tags - <a href="http://www.6curl.com/tags/rpm/" rel="tag">rpm</a> , <a href="http://www.6curl.com/tags/bulid/" rel="tag">bulid</a> , <a href="http://www.6curl.com/tags/linux/" rel="tag">linux</a> , <a href="http://www.6curl.com/tags/redhat/" rel="tag">redhat</a>
]]>
</description>
</item><item>
<link>http://www.6curl.com/lighttpd-modcache/</link>
<title><![CDATA[lighttpd+modcache VS Nginx+proxy_store]]></title> 
<author>张明辉 &lt;admin@6curl.com&gt;</author>
<category><![CDATA[系统服务配置]]></category>
<pubDate>Fri, 28 May 2010 04:06:41 +0000</pubDate> 
<guid>http://www.6curl.com/lighttpd-modcache/</guid> 
<description>
<![CDATA[ 
	背景：<strong>目前Nginx 做缓存服务器也不是什么新鲜事了,起初nginx 支持缓存的时候也是为了缓解后端服务器的压力,当有请求时,Nginx才会把相应的文件保存在本地磁盘上，以备下次处理相同请求时使用。这样的配置可以当作简单的cache server来用，实现与Lighttpd mod_cache基本相同的功能。(也是我们今天搭建的服务)<br/>Lighttpd和Nginx都有很好的性能，Lighttpd mod_cache具备简单的缓存过期功能并支持PURGE方法，Nginx的proxy_store则不具备这样的功能，所以Nginx的proxy_store适合缓存永远不需要更新的对象。<br/></strong><br/><strong>而目前Nginx 的优势就是它支持更对的模块,尤其是Rewrite 比Lighttpd 更好实现.<br/>下面就是Nginx 简单通过proxy_store 方式实现的缓存配置</strong><br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">upstream backend &#123;<br/>server 192.168.0.1:80;<br/>&#125;<br/>server &#123;<br/>listen 80;<br/>server_name <a href="http://www.example.com;" target="_blank">www.example.com;</a><br/>location / &#123;<br/>root /data/www;<br/>error_page 404 = /fetch$uri;<br/>&#125;<br/>location /fetch &#123;<br/>internal;<br/>proxy_pass <a href="http://backend;" target="_blank">http://backend;</a><br/>proxy_store on;<br/>proxy_store_access user:rw group:rw all:r;<br/>proxy_temp_path /data/temp;<br/>alias /data/www;<br/>&#125;<br/>&#125;</div></div><br/>今天我们尝试使用Lighttpd mod_cache 实现小图片的缓存。<br/><span style="font-size: 12px;">安装环境如下:<br/>操作系统: CentOS release 5.2 (Final)<br/>Kernel: 2.6.18-92.el5PAE</span><br/><br/>软件列表<br/><a href="ftp://oss.sgi.com/projects/fam/download/fam-latest.tar.gz" target="_blank">ftp://oss.sgi.com/projects/fam/download/fam-latest.tar.gz</a><br/><a href="http://www.gnome.org/~veillard/gamin/sources/gamin-0.1.10.tar.gz" target="_blank">http://www.gnome.org/~veillard/gamin/sources/gamin-0.1.10.tar.gz</a><br/><a href="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-7.9.tar.gz" target="_blank">ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-7.9.tar.gz</a><br/><a href="http://www.linux.com.cn/modcache/lighttpd-1.4.23.modcache.v.1.8.0.tar.gz" target="_blank">http://www.linux.com.cn/modcache/lighttpd-1.4.23.modcache.v.1.8.0.tar.gz</a><br/><br/>软件存放位置<br/>/data/software<br/><br/>安装过程<br/><br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">#cd /data/software/pkg<br/>安装依赖插件pcre, fam, gamin<br/>关于FAM <a href="http://oss.sgi.com/projects/fam/faq.html" target="_blank">http://oss.sgi.com/projects/fam/faq.html</a><br/>关于gamin <a href="http://www.gnome.org/~veillard/gamin/overview.html" target="_blank">http://www.gnome.org/~veillard/gamin/overview.html</a><br/>See also: <a href="http://trac.lighttpd.net/trac/wiki/server.stat-cache-engineDetails" target="_blank">http://trac.lighttpd.net/trac/wiki/server.stat-cache-engineDetails</a><br/>#tar zxvf ../pcre-7.9.tar.gz<br/>#cd pcre-7.9<br/>#./configure<br/>#make && make install<br/>#cd ..<br/>#tar zxvf ../fam-latest.tar.gz<br/>#cd fam-2.7.0/<br/>#./configure<br/>#make && make install<br/>#cd ..<br/>#tar zxvf ../gamin-0.1.10.tar.gz<br/>#cd gamin-0.1.10<br/>#./configure<br/>#make && make install<br/></div></div><br/>安装lighttpd with modcache<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">#cd /data/software/pkg<br/>#tar zxvf ../lighttpd-1.4.23.modcache.v.1.8.0.tar.gz<br/>#cd lighttpd-1.4.23<br/>#./configure --with-fam --prefix=/usr/local/lighttpd<br/>#make && make install</div></div><br/><br/>编辑lighttpd配置文件<br/><br/>#cp doc/lighttpd.conf /etc/<br/>#vi /etc/lighttpd.conf<br/><textarea name="code" class="php" rows="15" cols="100">
#启用的modules
server.modules&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"mod_redirect",
&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;&nbsp;&nbsp;"mod_access",
&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;&nbsp;&nbsp;"mod_status",
&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;&nbsp;&nbsp;"mod_cache",
&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;&nbsp;&nbsp;"mod_proxy",
&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;&nbsp;&nbsp;"mod_compress",
&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;&nbsp;&nbsp;"mod_expire",
&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;&nbsp;&nbsp;"mod_accesslog" )
server.pid-file&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= "/var/run/lighttpd.pid"
server.max-keep-alive-requests = 16
server.max-keep-alive-idle = 4
server.max-read-idle = 60
server.max-write-idle = 360
server.event-handler = "linux-sysepoll" #使用epoll作为事件处理
server.network-backend = "linux-sendfile"#使用sendfile
server.max-fds = 65535 #修改最大file descriptions，跟squid相同
server.stat-cache-engine = "fam"#启用fam作为stat处理方法
cache.support-queries = "enable"#此项打开以后缓存文件时将忽略?，即a.jpg?xxx和a.jpg?xyz都等同于a.jpg
cache.bases = ("/srv/lcache")#指定本地缓存存放路径
#定义刷新
cache.refresh-pattern = (
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"&#92;.(?i)(flv)$" => "0 fetchall-for-range-request flv-streaming", # to work with mod_flv_streaming for flv files
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"&#92;.(?i)(js&#124;css&#124;xml)$" => "10080", # update js/css/xml every 7 days and on refresh requests
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"&#92;.(?i)(htm&#124;html&#124;shtml)$" => "10080", # update html/htm/shtml every 7 days and on refresh requests
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"&#92;.(?i)(jpg&#124;bmp&#124;jpeg&#124;gif&#124;png)$" => "60", # update graphics files every 2 hours
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"&#92;.(?i)(rar&#124;zip&#124;wmv&#124;avi&#124;mp3&#124;ape&#124;rm&#124;mpeg&#124;mpg&#124;wma&#124;asf&#124;rmvb&#124;flv)$" => "0 fetchall-for-range-request", # cache media file forever
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"." => "60 update-on-refresh" # default to update every hour and on refresh requests
)
cache.purge-host = "^(192&#92;.168&#92;.)"#允许purge的ip
#保存缓存时忽略站点主机名（需要多个站点缓存不同文件的不要启用）
cache.ignore-hostname = "enable"
#后端服务器（源站）
proxy.server&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ( "localhost" =>
&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;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "host" => "192.168.1.15",
&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;&nbsp;&nbsp;&nbsp;&nbsp; "port" => 80
&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;&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;&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; )
proxy.worked-with-mod-cache = "enable"#这项一定要启用
#设置指定IP允许查看服务器状态和缓存命中率
$HTTP["remoteip"] =~ "192&#92;.168&#92;.1&#92;.*" &#123;
&nbsp;&nbsp;status.status-url&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= "/server-status"
&nbsp;&nbsp;status.stastics-url&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= "/cache-status"
&#125;
#防盗链
$HTTP["referer"] !~ "^($&#124;<a href="http://." target="_blank">http://.</a>*&#92;.(baidu&#92;.com&#124;google&#92;.com&#124;google&#92;.cn))" &#123;
&nbsp;&nbsp;&nbsp;&nbsp;url.redirect = ( ".*" => "http://img1.6curl.com/a.jpg" )
&#125;
</textarea><br/>启动lighttpd<br/>#/usr/local/lighttpd/sbin/lighttpd -f /etc/lighttpd.conf<br/><br/>参考文档<br/><a href="http://redmine.lighttpd.net/projects/1/wiki/Docs:Performance" target="_blank">http://redmine.lighttpd.net/projects/1/wiki/Docs:Performance</a><br/><a href="http://blog.fosketts.net/2009/06/29/tuning-lighttpd-linux/" target="_blank">http://blog.fosketts.net/2009/06/29/tuning-lighttpd-linux/</a><br/><a href="http://trac.lighttpd.net/trac/wiki/server.stat-cache-engineDetails" target="_blank">http://trac.lighttpd.net/trac/wiki/server.stat-cache-engineDetails</a><br/><br/>关于日志rotate和启动脚本<br/><a href="http://www.cyberciti.biz/tips/lighttpd-rotating-logs-with-logrotate.html" target="_blank">http://www.cyberciti.biz/tips/lighttpd-rotating-logs-with-logrotate.html</a><br/><a href="http://www.cyberciti.biz/tips/redhat-enterprise-linux-lighttpd-fastcgi-php.html" target="_blank">http://www.cyberciti.biz/tips/redhat-enterprise-linux-lighttpd-fastcgi-php.html</a><br/>Tags - <a href="http://www.6curl.com/tags/lighttpd/" rel="tag">lighttpd</a> , <a href="http://www.6curl.com/tags/modcache/" rel="tag">modcache</a> , <a href="http://www.6curl.com/tags/squid/" rel="tag">squid</a> , <a href="http://www.6curl.com/tags/cache/" rel="tag">cache</a>
]]>
</description>
</item>
</channel>
</rss>