<?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>HackGou In Lamp&#124;憨狗点灯 &#187; Apache</title>
	<atom:link href="http://hackgou.itbbq.com/category/apache/feed" rel="self" type="application/rss+xml" />
	<link>http://hackgou.itbbq.com</link>
	<description>LAMP开放的是代码，是接口，是互操作性</description>
	<lastBuildDate>Thu, 15 Jul 2010 14:23:06 +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>再次质疑Django+M od_python时对环境 变量的处理</title>
		<link>http://hackgou.itbbq.com/%e5%86%8d%e6%ac%a1%e8%b4%a8%e7%96%91djangom-od_python%e6%97%b6%e5%af%b9%e7%8e%af%e5%a2%83-%e5%8f%98%e9%87%8f%e7%9a%84%e5%a4%84%e7%90%86.html</link>
		<comments>http://hackgou.itbbq.com/%e5%86%8d%e6%ac%a1%e8%b4%a8%e7%96%91djangom-od_python%e6%97%b6%e5%af%b9%e7%8e%af%e5%a2%83-%e5%8f%98%e9%87%8f%e7%9a%84%e5%a4%84%e7%90%86.html#comments</comments>
		<pubDate>Thu, 17 Jan 2008 04:12:01 +0000</pubDate>
		<dc:creator>HackGou</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[django]]></category>

		<guid isPermaLink="false">http://hackgou.itbbq.com/%e5%86%8d%e6%ac%a1%e8%b4%a8%e7%96%91djangom-od_python%e6%97%b6%e5%af%b9%e7%8e%af%e5%a2%83-%e5%8f%98%e9%87%8f%e7%9a%84%e5%a4%84%e7%90%86.html</guid>
		<description><![CDATA[今天在升级一个django开发的系统到V2的时候，
发现~/无法正确的展开成 /home/hackgou.(apache是以hackgou帐号执行的，)
也不会展开成/root（apache是以root启动的） 觉得非常奇怪，
就算是用os.path.expanduser(&#8216;~/&#8217;)也无济于事。 于是怀疑是os.envrion['HOME']不对，
因为expanduser是需要这个变量来展开~/的。 于是使用setenv HOME /home/hackgou/ 可是也不工作，
后来在django/core/handlers/modpython.py的ModPythonHandler中 发现Django开发组已经注意到，
mod_python不理会apache的setENV指令：
 # mod_python fakes the environ, and thus doesn&#8217;t process SetEnv.  This fixes that
os.environ.update(req.subprocess_env)
但是这个和SetEnv DJANGO_SETTINGS_MODULE app.settings 自相矛盾矛盾，真晕，
自己不设置正确的，也不搭理管理员指定的，怎么办？
后来在http://code.google.com/p/modwsgi/wiki/ApplicationIssues找到一些类似的情况，
 提到sudo的时候有bug，会导致HOME和root启动的HOME不一样，太好了，我就要这样的bug。
设置hackgou账号的sudo权限，然后用sudo来启动apache，果然所有的expanduser(&#8216;~/&#8217;)都顺利。
 除此之外， 文中提到
import os, pwd os.environ["HOME"] = pwd.getpwuid(os.getuid()).pw_dir
这样的代码，似乎可以解决这个问题，神啊，我很反感这种做法：
 1.django中似乎没有地方可以放置这样的需要这个APP都需要的代码，我的DRY啊
2.Django修改环境变量似乎成了习惯，之前碰到个TIME_ZONE的问题，就是因为修改了APACHE的环境变量，
导致 别的应用环境受到污染，要知道一个apache进程是很多应用共享的， 除了Djano还有别的应用，
比如别的Django应用或者PHP，都有可能在一个相同的APACHE进程空间中处理，
说有可能是因为apache本身的一些设置会出现这些差别，跟py没有关系， 这样会导致他们的工作环境受到污染。
这似乎没有好的方法可以解决这个问题， 对Django或者说对mod_python 的这种拖泥带水的做法感觉非常的不爽。
也不知道有没有更好的更彻底的解决方法？
如果谁知道，能够告诉我那是最好不过的了
]]></description>
		<wfw:commentRss>http://hackgou.itbbq.com/%e5%86%8d%e6%ac%a1%e8%b4%a8%e7%96%91djangom-od_python%e6%97%b6%e5%af%b9%e7%8e%af%e5%a2%83-%e5%8f%98%e9%87%8f%e7%9a%84%e5%a4%84%e7%90%86.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Apache乱码问题</title>
		<link>http://hackgou.itbbq.com/apache%e4%b9%b1%e7%a0%81%e9%97%ae%e9%a2%98.html</link>
		<comments>http://hackgou.itbbq.com/apache%e4%b9%b1%e7%a0%81%e9%97%ae%e9%a2%98.html#comments</comments>
		<pubDate>Wed, 21 Nov 2007 16:09:01 +0000</pubDate>
		<dc:creator>HackGou</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://hackgou.itbbq.com/apache%e4%b9%b1%e7%a0%81%e9%97%ae%e9%a2%98.html</guid>
		<description><![CDATA[很多时候，浏览器并不按照指定的编码来显示页面。 导致乱码。其实这和http头中的设置有很大关系：
Content-Type: text/html; charset=utf-8
当http头中有这一行的时候，浏览器总是按照这个头指示的编码来显示页面内容，
而忽略Meta tag中的设置。如果Meta和Content-Type 的charset一致时，一切都是正常的，
而一旦不一样，那就会出现问题。
而apache本身是可以通过AddDefaultCarset XXX来来设置 http头中的默认字符编码，
同时当apache和php在一起的时候，还有php.ini的一个设置会影响这个http头的默认编码：
default_charset = &#8220;utf-8&#8243;
而这个default_charset 的设置会覆盖apache的AddDefaultCarset配置，
当然也可以在每个php里面手动调用
header(&#8220;content-type:text/html; charset=xxx&#8221;)
来覆盖default_charset 的值，这么看来一共有四个地方 会对php的执行结果产生影响： 优先级别从高到低：
php的header(&#8220;content-type:text/html; charset=xxx&#8221;)函数
php.ini里面的default_charset 设置
httpd.conf 中的AddDefaultCarset设置
最后才是html代码中的：META tag
其实最简单的办法是把php.ini中的default_charset和httpd.conf中的AddDefaultCarset置空。 通过Meta tag来指定编码，header只是临时性的改变编码的最后关口。
]]></description>
		<wfw:commentRss>http://hackgou.itbbq.com/apache%e4%b9%b1%e7%a0%81%e9%97%ae%e9%a2%98.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>httperf原来这么猛</title>
		<link>http://hackgou.itbbq.com/httperf%e5%8e%9f%e6%9d%a5%e8%bf%99%e4%b9%88%e7%8c%9b.html</link>
		<comments>http://hackgou.itbbq.com/httperf%e5%8e%9f%e6%9d%a5%e8%bf%99%e4%b9%88%e7%8c%9b.html#comments</comments>
		<pubDate>Thu, 27 Sep 2007 21:06:02 +0000</pubDate>
		<dc:creator>HackGou</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://hackgou.itbbq.com/httperf%e5%8e%9f%e6%9d%a5%e8%bf%99%e4%b9%88%e7%8c%9b.html</guid>
		<description><![CDATA[httperf 和ab是两个web benchmark的好工具。
今天为了测试美国的两个站点的响应，把httperf的 &#8211;num-conn 设成
5000。结果不到10分钟，nagios的警报就发到手机上了：有4台服务器负载告急！简直不可思议：服务器是7台webweb加12台db组成的集群。而这个命令行只是在一台普通的pc
server上面执行的。对着其中的一台服务器做日志分析：
 0 :   918       3.23%
 1 :   470       1.65%
 2 :   427       1.50%
 3 :  1253       4.41%
 4 :  [...]]]></description>
		<wfw:commentRss>http://hackgou.itbbq.com/httperf%e5%8e%9f%e6%9d%a5%e8%bf%99%e4%b9%88%e7%8c%9b.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>p  spell和recode居然会让php5挂掉？</title>
		<link>http://hackgou.itbbq.com/p-spell%e5%92%8crecode%e5%b1%85%e7%84%b6%e4%bc%9a%e8%ae%a9php5%e6%8c%82%e6%8e%89%ef%bc%9f.html</link>
		<comments>http://hackgou.itbbq.com/p-spell%e5%92%8crecode%e5%b1%85%e7%84%b6%e4%bc%9a%e8%ae%a9php5%e6%8c%82%e6%8e%89%ef%bc%9f.html#comments</comments>
		<pubDate>Sat, 20 Jan 2007 04:54:01 +0000</pubDate>
		<dc:creator>blog</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[port]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://hackgou.itbbq.com/p-spell%e5%92%8crecode%e5%b1%85%e7%84%b6%e4%bc%9a%e8%ae%a9php5%e6%8c%82%e6%8e%89%ef%bc%9f.html</guid>
		<description><![CDATA[从port安装的php5和extension中，pspell和recode两个扩展居然会导致php 挂掉，
有些不可思意，也许是 这两个扩展需要额外的lib没有安装，引发经典的库依赖问题？？
;extension=pspell.so
;extension=recode.so
还好，这两个扩展根本用不到，注释之
不能从根本上解决问题，那让问题根本不会出现，未尝不是一个根本上解决问题的法子   :P
]]></description>
		<wfw:commentRss>http://hackgou.itbbq.com/p-spell%e5%92%8crecode%e5%b1%85%e7%84%b6%e4%bc%9a%e8%ae%a9php5%e6%8c%82%e6%8e%89%ef%bc%9f.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>除了apache还有什么？</title>
		<link>http://hackgou.itbbq.com/%e9%99%a4%e4%ba%86apache%e8%bf%98%e6%9c%89%e4%bb%80%e4%b9%88.html</link>
		<comments>http://hackgou.itbbq.com/%e9%99%a4%e4%ba%86apache%e8%bf%98%e6%9c%89%e4%bb%80%e4%b9%88.html#comments</comments>
		<pubDate>Thu, 09 Nov 2006 14:12:19 +0000</pubDate>
		<dc:creator>HackGou</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mathopd]]></category>
		<category><![CDATA[SRR]]></category>
		<category><![CDATA[TUX]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://hackgou.itbbq.com/%e9%99%a4%e4%ba%86apac-he%e8%bf%98%e6%9c%89%e4%bb%80%e4%b9%88%ef%bc%9f.html</guid>
		<description><![CDATA[作为开源的web server apache2可谓占尽天时地利人和：不仅开源社区的人对他顶礼膜拜，乃至
其他平台的的web server也敬他三分。
但是到底在开源阵营中还有些什么出色的web server呢？

&#160;

首先映入眼帘的是lighttpd：
http://www.lighttpd.net/
lighttpd的兴起，和rails密不可分。
lighttpd+ SCGI&#160;(SRR)是rails社区公认的不二选择。
SCGI作为fastCGI的天然替代物，对所有支持 SCGI协议的web server都可以实现无缝移植。
其实除了SCGI之外，类似php的mod_php、ruby也有apache的 mod_ruby。也可以和apache
集成，当然这是apache dependent的。
&#160;
在性能方面，普遍的说法是lighttpd比apache2快过4、5倍，连lighttpd官方的说法也是快过2、3倍
当然也有人嚷嚷：lighttpd在扯蛋&#160;（当然我们得注意一下这家伙的背景）
真是公说公有理、婆说婆有理
&#160;
另外还有一个thttpd，性能也非常出色
http://www.acme.com/software/thttpd/benchmarks.html



实线部分是处理处理1000个1kB大小的文件，Java实现的Acme.Serve和Jigsaw连测试都没有承受住，
就挂了。&#160; :P
虚线部分是使用很简单的CGI hello world&#34; C program.作为CGI测试的。
在这份benchmark中，出现了另外一个BSD license的web server:Mathopd&#160;优秀的CGI性能简直让人大跌眼镜
但是不知道真实的生产环境性能如何！
&#160;
说道静态文件服务，不得不提一下TUX：
虽然没有具体的数据说明TUX的性能个到底如何，但是业界广泛认为：作为运行于内核空间的TUX，由于少了
content切换的开销，相比其他用户空间的web server比如apache反应快速的多，另外Red Hat给他的学名儿
叫：Red Hat Content Accelerator&#160;。所以提供image之类的服务是在适合不过的了，但是也正是因为这个最大
的优势限制了他在其他平台的使用，是一个linux dependent的web server。同时，运行于内核空间的他，
一旦crash，后果可想而知。
&#160;

更多的web server list可以参考这儿：
http://en.wikipedia.org/wiki/Comparison_of_web_servers

]]></description>
		<wfw:commentRss>http://hackgou.itbbq.com/%e9%99%a4%e4%ba%86apache%e8%bf%98%e6%9c%89%e4%bb%80%e4%b9%88.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>fastCGI方式跑Django</title>
		<link>http://hackgou.itbbq.com/fastcgi%e6%96%b9%e5%bc%8f%e8%b7%91django.html</link>
		<comments>http://hackgou.itbbq.com/fastcgi%e6%96%b9%e5%bc%8f%e8%b7%91django.html#comments</comments>
		<pubDate>Wed, 07 Jun 2006 17:08:15 +0000</pubDate>
		<dc:creator>HackGou</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[django]]></category>

		<guid isPermaLink="false">http://hackgou.itbbq.com/fastcgi%e6%96%b9%e5%bc%8f%e8%b7%91django/</guid>
		<description><![CDATA[原本想找个支持mod_python的空间来玩玩，但是要么太贵要么速度太慢，终究还是选择了dreamhost，在他上面买了支持python的空间，打算好好玩玩python这个东东，之前看了看上面的环境：
hackgou@runts:~$whereis python 
python: /usr/bin/python /usr/bin/python2.3 /usr/bin/python2.2-popy-config \
/usr/bin/python2.2 /usr/bin/python2.4 /etc/python2.3 /etc\
/python2.4 /etc/python2.2 /usr/lib/python2.3 /usr/lib/python2.2 \
/usr/lib/python2.4 /usr/local/lib/python2.3 /usr/local/lib/python2.\
2 /usr/local/lib/python2.4 /usr/include/python2.3 /usr/include/python2.2 \
/usr/include/python2.4 /usr/share/man/man1/python.1.gz  
呵呵，够夸张的，从2.2到2.4的版本都有。
还好！fastCGI的支持是知道的，上面的主机对python和perl的支持都是通过FastCGI的方式实现的。以前没有彻底的玩过FastCGI、更别说python的FastCGI了。首先是添加一个Python的FastCGI gateway。虽然dreamhost的wiki上面说使用fcgi.py比较方便，但是后来发现Flup，这也是一个Frame
不光有fastCGI gateway，而且他提供一个类似mod_python的publish的东东，那就用他了：
wget http://www.saddi.com/software/flup/dist/flup-r1968.tar.gz
wget抓来之后。用setup.py安装。/usr/lib/python2.4 咱是没有权限，那就在~/下面建立一个自己的lib-python,作为自己的$PYTHONPATH。
在.bash_prifile里面添加export $PYTHONPATH=$PYTHONPATH:~/lib-python 
OK，开始安装我们自己的lib：
python2.4 setup.py install --install-lib&#160; ~/lib-python/ --install-scripts ~/lib-python/
这样会安装到我自己的lib-python而不是默认的/usr/lib/python2.4/site-packages/。
OK，写个简单的helloworld.py（flup的fcig路径是from flup.server.fcgi import WSGIServer），测试一下flup。OK。通过
然后svn把django的代码也拉到lib-python中去。再按照django的手册创建一个demo，写一个简单的测试app.py。页面是出来了，但是是django报错的东东。还好，聊胜于无。为什么呢？东翻翻、西翻翻，看到木头的文章，他说rewrite后能够成功，但是我还悄悄的去http://www.djangocn.org/django.fcgi看了看，呵呵和我的错误一样。不可能跟这个rewrite有关系的吧，既然如此，那我就添加重写规则吧，一添加，呵呵，果然奏效。
It worked!
页面出来了，不知道为什么rewrite和这个有啥关系，迷糊
 update: 
  如果希望避免export $PYTHONPATH=$PYTHONPATH:~/lib-python 而且也不想添加一堆的path.append()，可以参考：
让easy_install构造自己的py thon小天地 
]]></description>
		<wfw:commentRss>http://hackgou.itbbq.com/fastcgi%e6%96%b9%e5%bc%8f%e8%b7%91django.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
