<?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>Hello, SA &#187; apache</title>
	<atom:link href="http://blog.helosa.org/tag/apache/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.helosa.org</link>
	<description>Could u fix the problem for me ?</description>
	<lastBuildDate>Sat, 04 Sep 2010 19:51:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>apache rewrite 与linux软链的一个小问题</title>
		<link>http://blog.helosa.org/2010/02/09/apache-rewrite-softlink.html</link>
		<comments>http://blog.helosa.org/2010/02/09/apache-rewrite-softlink.html#comments</comments>
		<pubDate>Tue, 09 Feb 2010 08:04:49 +0000</pubDate>
		<dc:creator>Chan Cham Chung</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://lazybug.me/?p=58</guid>
		<description><![CDATA[一个项目是apache+resin的架构，有一条 rewrite 规则是这样的： RewriteRule ^/flashinfo/vinfo/([a-z0-9A-Z_]+).xml$ /video/videolist.htm?sid=$1 [PT,L] 其中，\.htm 交给resin处理 &#60;LocationMatch (.*)\.htm&#62; SetHandler caucho-request &#60;/LocationMatch&#62; 理论上，访问 /flashinfo/vinfo/V5OJEFN7C.xml 文件，是会代理访问到 /video/videolist.htm?sid=V5OJEFN7C 的。 但事实上，却403了，如下： $curl -I -H host:so.v.test.com http://127.0.0.1/flashinfo/vinfo/V5OJEFN7C.xml HTTP/1.1 403 Forbidden Date: Tue, 09 Feb 2010 07:29:30 GMT Server: Apache/2.2.11 &#40;Unix&#41; Resin/3.0.26 Content-Type: text/html; charset=iso-8859-1 让我看看rewrite后的访问是否正常： $curl -I -H host:so.v.test.com http://127.0.0.1/video/videolist.htm?sid=V5OJEFN7C HTTP/1.1 200 OK Date: Tue, 09 Feb [...]]]></description>
			<content:encoded><![CDATA[<p>一个项目是apache+resin的架构，有一条 rewrite 规则是这样的：</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">RewriteRule</span> ^/flashinfo/vinfo/([a-z0-9A-Z_]+).xml$ /video/videolist.htm?sid=$<span style="color: #ff0000;">1</span> [PT,L]</pre></div></div>

<p>其中，\.htm 交给resin处理</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">&lt;<span style="color: #000000; font-weight:bold;">LocationMatch</span> (.*)\.htm&gt;
<span style="color: #00007f;">SetHandler</span> caucho-request
&lt;/<span style="color: #000000; font-weight:bold;">LocationMatch</span>&gt;</pre></div></div>

<p>理论上，访问 /flashinfo/vinfo/V5OJEFN7C.xml 文件，是会代理访问到 /video/videolist.htm?sid=V5OJEFN7C 的。</p>
<p>但事实上，却403了，如下：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">$curl</span> <span style="color: #660033;">-I</span> <span style="color: #660033;">-H</span> host:so.v.test.com http:<span style="color: #000000; font-weight: bold;">//</span>127.0.0.1<span style="color: #000000; font-weight: bold;">/</span>flashinfo<span style="color: #000000; font-weight: bold;">/</span>vinfo<span style="color: #000000; font-weight: bold;">/</span>V5OJEFN7C.xml
HTTP<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1.1</span> <span style="color: #000000;">403</span> Forbidden
Date: Tue, 09 Feb <span style="color: #000000;">2010</span> 07:<span style="color: #000000;">29</span>:<span style="color: #000000;">30</span> GMT
Server: Apache<span style="color: #000000; font-weight: bold;">/</span>2.2.11 <span style="color: #7a0874; font-weight: bold;">&#40;</span>Unix<span style="color: #7a0874; font-weight: bold;">&#41;</span> Resin<span style="color: #000000; font-weight: bold;">/</span>3.0.26
Content-Type: text<span style="color: #000000; font-weight: bold;">/</span>html; <span style="color: #007800;">charset</span>=iso-<span style="color: #000000;">8859</span>-<span style="color: #000000;">1</span></pre></div></div>

<p>让我看看rewrite后的访问是否正常：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">$curl</span> <span style="color: #660033;">-I</span> <span style="color: #660033;">-H</span> host:so.v.test.com http:<span style="color: #000000; font-weight: bold;">//</span>127.0.0.1<span style="color: #000000; font-weight: bold;">/</span>video<span style="color: #000000; font-weight: bold;">/</span>videolist.htm?<span style="color: #007800;">sid</span>=V5OJEFN7C
HTTP<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1.1</span> <span style="color: #000000;">200</span> OK
Date: Tue, 09 Feb <span style="color: #000000;">2010</span> 07:<span style="color: #000000;">33</span>:<span style="color: #000000;">23</span> GMT
Server: Apache<span style="color: #000000; font-weight: bold;">/</span>2.2.11 <span style="color: #7a0874; font-weight: bold;">&#40;</span>Unix<span style="color: #7a0874; font-weight: bold;">&#41;</span> Resin<span style="color: #000000; font-weight: bold;">/</span>3.0.26
Cache-Control: max-age=<span style="color: #000000;">600</span>
Expires: Tue, 09 Feb <span style="color: #000000;">2010</span> 07:<span style="color: #000000;">43</span>:<span style="color: #000000;">23</span> GMT
Content-Type: text<span style="color: #000000; font-weight: bold;">/</span>html</pre></div></div>

<p>究竟什么原因呢？？我看了一下，应该是这样的：</p>
<p>原因在于，在DocumentRoot下，有一个错误的软链video.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">$ls</span> -alh<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> video
lrwxrwxrwx  <span style="color: #000000;">1</span> root root   <span style="color: #000000;">29</span> 02-09 <span style="color: #000000;">15</span>:<span style="color: #000000;">29</span> video -<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #000000; font-weight: bold;">/</span>data<span style="color: #000000; font-weight: bold;">/</span>videopage</pre></div></div>

<p>而/data/videopage这个目录是不存在的，所以video是一个错误的软链，rewrite 后的地址是 /video/videolist.htm?sid=$1 ，这样就爆403了。</p>
<p>真奇怪，其实apache 根本不用管我有没有video 这个目录的，因为都是转发到resin 去处理的了。既然想不通，就先记下。。。</p>
<p>我还做了两个测试：</p>
<p>1，让 video 成为一个正确的软链，curl 测试结果，200 。</p>
<p>2，把 video 删去，不存在这个软链，curl 测试结果，200。</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>结论：apache rewrite 后的地址，如 /data/dopost.jsp?sid=$1 这种，如果data 是一个错误的软链，尽管动态程序/data/dopost.jsp?sid=$1是正确的，apache 的 rewrite 都会不成功，返回 403 。如果 data 是一个正确的软链或者压根不存在，apache 正确地rewrite 。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.helosa.org/2010/02/09/apache-rewrite-softlink.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>新搭建的nagios+pnp爆的一个错误</title>
		<link>http://blog.helosa.org/2010/01/19/nagios-pnp-php.html</link>
		<comments>http://blog.helosa.org/2010/01/19/nagios-pnp-php.html#comments</comments>
		<pubDate>Tue, 19 Jan 2010 11:33:10 +0000</pubDate>
		<dc:creator>Chan Cham Chung</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[nagios]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://lazybug.me/?p=31</guid>
		<description><![CDATA[部门明天要上一个大项目啊，我今天赶紧搭监控。 原谅我这个古董，21 世纪了，还在搭nagios。。。web 环境，我也还是很古董地选用apache + php_module 的方式。。。其实监控系统来说，没什么性能要求，apache和nagios 也符合我的需求了，好，开始！！ 首先爆了一堆这样的错： Deprecated: Assigning the return value of new by reference is deprecated in /data/nagios/share/pnp/include/function.inc.php on line 1029 Warning: date() [function.date]: It is not safe to rely on the system&#8217;s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used [...]]]></description>
			<content:encoded><![CDATA[<p>部门明天要上一个大项目啊，我今天赶紧搭监控。</p>
<p>原谅我这个古董，21 世纪了，还在搭nagios。。。web 环境，我也还是很古董地选用apache + php_module 的方式。。。其实监控系统来说，没什么性能要求，apache和nagios 也符合我的需求了，好，开始！！</p>
<p>首先爆了一堆这样的错：</p>
<p><strong>Deprecated</strong>:  Assigning the return value of new by reference is deprecated in <strong>/data/nagios/share/pnp/include/function.inc.php</strong> on line <strong>1029</strong></p>
<p><strong>Warning</strong>:  date() [<a href="http://60.191.80.115:8163/nagios/pnp/function.date">function.date</a>]: It is not safe to rely on the system&#8217;s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected &#8216;Asia/Chongqing&#8217; for &#8216;CST/8.0/no DST&#8217; instead in <strong>/data/nagios/share/pnp/include/function.inc.php</strong> on line <strong>560</strong></p>
<p>貌似 5.3.0 才报这样的错，5.2.9 也没有爆啊。。。没错，我是很懒，但一般我都会追求真相的。但是，项目明天就要上线了啊，时间不允许我这样玩了，我还是懒一点吧。。。以解决问题为最终目标！！</p>
<p>让我设timezone。。。不太会php啊。。。也没研究过nagios的架构。。。直接一点吧，见到什么改什么！！</p>
<p>function.inc.php 貌似是一个基础函数，每个函数都会include它的，我在里面显式地指定timezone总可以吧，于是在function.inc.php 里加一句</p>
<p>date_default_timezone_set(&#8216;Asia/Chongqing&#8217;);</p>
<p>哈哈，timezone 的 warning 解决了！但问题随之又来了。。。又报错。。。</p>
<p><strong>Deprecated</strong>:  Function eregi() is deprecated in <strong>/data/nagios/share/pnp/include/function.inc.php</strong> on line <strong>1505</strong></p>
<p>函数 deprecated 了。。。算了，我决定改php.ini，屏蔽错误和warning！</p>
<p>打开 phpinfo() 看一下php.ini 在哪里，找不到。。。</p>
<p>在 httpd.conf 里加一句：</p>
<p><strong>PHPIniDir &#8220;/data/apache/conf&#8221;</strong></p>
<p>随便copy一个php.ini过来，刚才google了一下，好像是 error_reporting 的问题，但不管我怎么改error_reporting的组合，都无法成功。。。突然被我看到这样的字眼：</p>
<p>display_errors = On</p>
<p>哈哈，还不是你！！把你关了总可以了吧！！</p>
<p>display_errors = Off</p>
<p>apachectl graceful 一下，哈哈，问题解决了！！！可以用了！！继续配置监控。。。</p>
<p>唉，LAMP 如此经典的组合，我了解得还是不够啊！！</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.helosa.org/2010/01/19/nagios-pnp-php.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
