<?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>Justin's Tech Blog &#187; Apache</title>
	<atom:link href="http://www.sofee.cn/blog/category/technical/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sofee.cn/blog</link>
	<description>世界其实很简单，复杂的是人；生活其实很轻松，沉重的是感情！</description>
	<lastBuildDate>Sun, 17 Jan 2010 17:17:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>CentOS下安装Subversion&amp;Trac</title>
		<link>http://www.sofee.cn/blog/2007/06/19/54/</link>
		<comments>http://www.sofee.cn/blog/2007/06/19/54/#comments</comments>
		<pubDate>Tue, 19 Jun 2007 05:54:49 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[SQLite]]></category>
		<category><![CDATA[mod_dav_svn]]></category>
		<category><![CDATA[mod_python]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[Trac]]></category>
		<category><![CDATA[Wiki]]></category>
		<category><![CDATA[中文包]]></category>

		<guid isPermaLink="false">http://www.sofee.cn/blog/2007/06/19/54/</guid>
		<description><![CDATA[本文将采用Apache 2.2.3+Subversion1.4.2+Python 2.4.3+SQLite 3.3.6+Trac 0.10.4架设。
服务器IP为：192.168.1.200
1、Apache、Subversion、Python和SQLite均采用默认安装即可，yum即可安装。

# yum install httpd httpd-devel swig subversion mod_dav_svn sqlite python python-devel python-sqlite mod_python

2、配置Subversion
下面将使用myapp这个仓库来配置Subversion

# mkdir -p /var/www/svn
&#160;
# cd /var/www/svn
&#160;
# svnadmin create myapp
&#160;
# chown -R apache:apache myapp
&#160;
# vi /etc/httpd/conf.d/subversion.conf


加入以下配置

LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so
&#160;
&#60;Location /svn&#62;
DAV svn
SVNParentPath /var/www/svn
#
#   # Limit write permission to list of valid users.
# [...]]]></description>
		<wfw:commentRss>http://www.sofee.cn/blog/2007/06/19/54/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>加速APACHE访问速度及节省网络带宽</title>
		<link>http://www.sofee.cn/blog/2006/10/21/48/</link>
		<comments>http://www.sofee.cn/blog/2006/10/21/48/#comments</comments>
		<pubDate>Sat, 21 Oct 2006 01:18:48 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[mod_deflate]]></category>

		<guid isPermaLink="false">http://www.sofee.cn/blog/?p=48</guid>
		<description><![CDATA[ 
var alimama_pid="mm_10006029_103557_106167"; 
var alimama_titlecolor="8ab459"; 
var alimama_descolor ="888888"; 
var alimama_bgcolor="FFFFFF"; 
var alimama_bordercolor="ffffff"; 
var alimama_linkcolor="8ab459"; 
var alimama_sizecode="12"; 
var alimama_width=468; 
var alimama_height=60; 
var alimama_type=2; 
 
 
 APACHE提供了一个mod_deflate模块，用于内容输出压缩过滤功能，可以有效的提高网站的访问速度及节省大量的带宽，所付出的成本是会对CPU增加微量的负担，因 此对于那些访问量非常大而带宽又不足的网站是个非常不错的选择。
本文依然以CentOS 4.4下的APACHE为例，默认安装下已经安装了mod_deflate模块，所要做的就是少量的配置而已。

# vi /etc/httpd/conf/httpd.conf


去掉下面这句的注释

LoadModule deflate_module modules/mod_deflate.so

在文件最后加入下面这段配置

&#60;IfModule mod_deflate.c&#62;
    SetOutputFilter DEFLATE
&#160;
#    DeflateFilterNote Input instream
#    DeflateFilterNote Output outstream
#    DeflateFilterNote Ratio [...]]]></description>
		<wfw:commentRss>http://www.sofee.cn/blog/2006/10/21/48/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>高负载WEB动态页面与静态页面的分离</title>
		<link>http://www.sofee.cn/blog/2006/10/19/47/</link>
		<comments>http://www.sofee.cn/blog/2006/10/19/47/#comments</comments>
		<pubDate>Thu, 19 Oct 2006 15:36:52 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Lighttpd]]></category>
		<category><![CDATA[mod_cache]]></category>
		<category><![CDATA[mod_proxy]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[性能]]></category>

		<guid isPermaLink="false">http://www.sofee.cn/blog/?p=47</guid>
		<description><![CDATA[试了一段时间的Lighttpd，表现的确不错，原先用APACHE只能跑到6K/S，改用Lighttpd后性能提升了将近一倍，只是跑PHP似乎很不稳定，数据库处理时间长一点就会到导致Lighttpd出现500的错误，也就是说要想使Lighttpd发挥更好的性能，除了优化程序还是优化程序，尽可能的加快PHP的执行速度，另外加上eAccelerator性能会有更大的提高。
说了这么多优点，再来说说公司最近所尝试的一些经验，PHP程序已被优化的不能再优化了，但是有时候操作一下数据库（比如执行mysqldump）就会出现500错误，并发量非常大的时候很容易出现，在这点上Lighttpd的表现就没有Apache稳定了，所以想了一个折中的办法，让Apache来处理PHP程序，其他的静态页面（包括图片、软件等等）全都交给Lighttpd来处理。而实现方法就是通过mod_proxy来实现，Apache做前端处理或Lighttpd做前端处理都行，反正这2种都有个mod_proxy模块，基本上一样。

下面就以CentOS 4.4系统下使用Apache（80端口）和Lighttpd（81端口）实现动态页面和静态页面的分离。
Apache采用系统默认安装（yum install apache）的即可，网上的安装文档也很多，偶就不再介绍了。
安装Lighttpd v1.4.13

# yum install pcre-devel
# cd /usr/local/src
# wget http://www.lighttpd.net/download/lighttpd-1.4.13.tar.gz
# tar -zxvf lighttpd-1.4.13.tar.gz
# cd lighttpd-1.4.13
# ./configure --with-pcre
# make
# make install
# cd doc
# cp sysconfig.lighttpd /etc/sysconfig/lighttpd
# cp rc.lighttpd.redhat /etc/init.d/lighttpd
# chkconfig lighttpd on
# mkdir -p /etc/lighttpd
# cp lighttpd.conf /etc/lighttpd/
# mkdir /var/log/lighttpd
# touch /var/log/lighttpd/access.log
# touch /var/log/lighttpd/error.log
# chown -R apache:apache /var/log/lighttpd


# vi /etc/init.d/lighttpd

将lighttpd=&#8221;/usr/sbin/lighttpd&#8221;改为lighttpd=&#8221;/usr/local/sbin/lighttpd&#8221;
编辑Lighttpd的配置文件lighttpd.conf，大致修改如下：

server.modules = ("mod_access", "mod_simple_vhost", "mod_accesslog" [...]]]></description>
		<wfw:commentRss>http://www.sofee.cn/blog/2006/10/19/47/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fix too many FIN_WAIT_2 connections under freebsd</title>
		<link>http://www.sofee.cn/blog/2006/08/26/33/</link>
		<comments>http://www.sofee.cn/blog/2006/08/26/33/#comments</comments>
		<pubDate>Sat, 26 Aug 2006 06:54:57 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Lighttpd]]></category>

		<guid isPermaLink="false">http://www.sofee.cn/blog/?p=33</guid>
		<description><![CDATA[查看FIN_WAIT_2连接数：

bsd#netstat -an &#124; grep FIN_WAIT_2 &#124; wc -l
2523

修改Lighttpd配置文件，加入下面这条语句：

server.max-keep-alive-requests = 0


bsd#netstat -an &#124; grep FIN_WAIT_2 &#124; wc -l
91

如果服务器开启了ipfw2防火墙的话，还需要执行：

sysctl -w net.inet.ip.fw.dyn_keepalive=0

p.s. 若为APACHE服务器，同理。

  addthis_url    = 'http%3A%2F%2Fwww.sofee.cn%2Fblog%2F2006%2F08%2F26%2F33%2F';
  addthis_title  = 'Fix+too+many+FIN_WAIT_2+connections+under+freebsd';
  addthis_pub    = 'sofeecn';

]]></description>
		<wfw:commentRss>http://www.sofee.cn/blog/2006/08/26/33/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
