<?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>Linux System Administrator</description>
	<lastBuildDate>Tue, 31 Jan 2012 08:28:25 +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>nginx+apache+dav_svn 的怪异问题</title>
		<link>http://blog.helosa.org/2011/07/03/nginx-apache-dav_svn.html</link>
		<comments>http://blog.helosa.org/2011/07/03/nginx-apache-dav_svn.html#comments</comments>
		<pubDate>Sun, 03 Jul 2011 08:04:53 +0000</pubDate>
		<dc:creator>Chan Cham Chung</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[troubleshooting]]></category>

		<guid isPermaLink="false">http://blog.helosa.org/?p=408</guid>
		<description><![CDATA[最近帮朋友的网站做个小优化，由apache 迁移到nginx ，结果问题多多，svn 在提交的时候竟然有这个错误： $ svn ci -m&#8221;fix the mail problem &#8220; Sending        util.php svn: Commit failed (details follow): svn: File &#8216;util.php&#8217; is out of date svn: &#8216;/svn/!svn/bc/496/trunk/util.php&#8217; path not found 但是提交其它文件貌似没有问题。怪异到爆！！！ 首先说说nginx 的配置。 svn 仍然使用 apache 的dav_svn ，只是端口由80 改为 1234，其它配置不改。 location  /svn { proxy_pass http://127.0.0.1:1234 ; proxy_set_header Host &#8220;svn.mysite.net&#8221; ; } [...]]]></description>
			<content:encoded><![CDATA[<p>最近帮朋友的网站做个小优化，由apache 迁移到nginx ，结果问题多多，svn 在提交的时候竟然有这个错误：</p>
<div id="_mcePaste">$ svn ci -m&#8221;fix the mail problem &#8220;</div>
<div id="_mcePaste">Sending        util.php</div>
<div id="_mcePaste">svn: Commit failed (details follow):</div>
<div id="_mcePaste">svn: File &#8216;util.php&#8217; is out of date</div>
<div id="_mcePaste">svn: &#8216;/svn/!svn/bc/496/trunk/util.php&#8217; path not found</div>
<div>但是提交其它文件貌似没有问题。怪异到爆！！！</div>
<p>首先说说nginx 的配置。</p>
<p>svn 仍然使用 apache 的dav_svn ，只是端口由80 改为 1234，其它配置不改。</p>
<p>location  /svn {</p>
<p>proxy_pass http://127.0.0.1:1234 ;</p>
<p>proxy_set_header Host &#8220;svn.mysite.net&#8221; ;</p>
<p>}</p>
<div>终于在google 大神找到一篇俄文的mailing-list（http://www.lexa.ru/nginx-ru/msg39625.html），竟然有人和我同样的错误，也终于弄清楚什么事了。。。简直是自己白痴！！</div>
<div>我的php 的配置：</div>
<div>
<div>location ~ \.php$ {</div>
<div>root           /var/www/backend/  ;</div>
<div>fastcgi_pass   127.0.0.1:9000;</div>
<div>fastcgi_index  index.php;</div>
<div>include        fastcgi.conf;</div>
<div>}</div>
</div>
<div>这个location 用了正则匹配，比svn 的普通location 优先级高，结果svn 提交util.php 的时候（会发送一堆svn 的指令如propfind , option 等），优先到php 的location 里，结果就出错了。。。</div>
<div>那svn 也用高优先级的location 匹配吧，修改一下，用前缀匹配：</div>
<div>location ^~ /svn</div>
<div>ok , 成功了。。。</div>
<div>事后我才看到，nginx 本身就有一个404 的log ：</div>
<div>211.102.143.12 &#8211; hello [03/Jul/2011:15:34:53 +0800] &#8220;PROPFIND /svn/!svn/bc/496/trunk/util.php HTTP/1.1&#8243; 404 31 &#8220;-&#8221; &#8220;SVN/1.6.15 (r1038135) neon/0.28.6&#8243; &#8220;-&#8221;</div>
<div>唉。。。怪自己～～</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.helosa.org/2011/07/03/nginx-apache-dav_svn.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cnnic 证书更新问题</title>
		<link>http://blog.helosa.org/2010/12/20/cnnic-https-cert.html</link>
		<comments>http://blog.helosa.org/2010/12/20/cnnic-https-cert.html#comments</comments>
		<pubDate>Mon, 20 Dec 2010 10:26:43 +0000</pubDate>
		<dc:creator>Chan Cham Chung</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[troubleshooting]]></category>

		<guid isPermaLink="false">http://blog.helosa.org/?p=370</guid>
		<description><![CDATA[最近为部门内部系统的https 快要过期的证书更新，出现了一系列的问题，很是郁闷！！一个字：恨！！ 原来从2010 年 3 月后，由cnnic 签发的证书，有所改变了。2010 年 3 月前，root CA 是 entrust ，中级CA 是cnnic 。3 月后，root 和中级CA ，都是cnnic 了。。。 cnnic 证书本身就没有多少诚信可言了，还做了root CA 。。。 举例说明： $curl -I https://blog.helosa.org/ 的时候，会有这类报错 curl: (60) SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed More details here: http://curl.haxx.se/docs/sslcerts.html curl performs SSL certificate verification [...]]]></description>
			<content:encoded><![CDATA[<p>最近为部门内部系统的https 快要过期的证书更新，出现了一系列的问题，很是郁闷！！一个字：恨！！</p>
<p>原来从2010 年 3 月后，由cnnic 签发的证书，有所改变了。2010 年 3 月前，root CA 是 entrust ，中级CA 是cnnic 。3 月后，root 和中级CA ，都是cnnic 了。。。</p>
<p>cnnic 证书本身就没有多少诚信可言了，还做了root CA 。。。</p>
<p>举例说明：</p>
<p>$curl -I https://blog.helosa.org/ 的时候，会有这类报错</p>
<div id="_mcePaste">curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:</div>
<div id="_mcePaste">error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed</div>
<div id="_mcePaste">More details here: http://curl.haxx.se/docs/sslcerts.html</div>
<div id="_mcePaste">curl performs SSL certificate verification by default, using a &#8220;bundle&#8221;</div>
<div id="_mcePaste">of Certificate Authority (CA) public keys (CA certs). If the default</div>
<div id="_mcePaste">bundle file isn&#8217;t adequate, you can specify an alternate file</div>
<div id="_mcePaste">using the &#8211;cacert option.</div>
<div id="_mcePaste">If this HTTPS server uses a certificate signed by a CA represented in</div>
<div id="_mcePaste">the bundle, the certificate verification probably failed due to a</div>
<div id="_mcePaste">problem with the certificate (it might be expired, or the name might</div>
<div id="_mcePaste">not match the domain name in the URL).</div>
<div id="_mcePaste">If you&#8217;d like to turn off curl&#8217;s verification of the certificate, use</div>
<div id="_mcePaste">the -k (or &#8211;insecure) option.</div>
<p>提示是说，加一个-k 的参数，就不会去验证证书了，但我想了解一下原因。它也给了提示，让我们去这个网页http://curl.haxx.se/docs/sslcerts.html 里了解详情。</p>
<p>通读了一次，大概了解了，因为root 和中级CA 都是cnnic ，并且根CA 的证书并不在curl 的信任列表里，curl 认为它是<span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">self-signed 证书，不安全，于是就报错了。</span></p>
<p>解决方案嘛，把cnnic 的root 证书wget 回来，在这里：http://www.cnnic.cn/uploadfiles/cer/2010/3/2/113823.cer</p>
<p>然后curl 时加上这个证书，curl &#8211;cacert 113823.cer https://blog.helosa.org/</p>
<p><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">=====================================================</span></p>
<p><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace;"><span style="line-height: 18px; white-space: pre;">在这个问题上，我有两个不明白的地方：</span></span></p>
<p><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace;"><span style="line-height: 18px; white-space: pre;">1，其实，可以将cnnic 的root 证书加入到信任列表的，信任列表在/etc/ssl/certs/ 里，通过 curl -vv 可以看到</span></span></p>
<p><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace;"><span style="line-height: 18px; white-space: pre;"> CAfile: none</span></p>
<p><span style="line-height: 18px; white-space: pre;"> CApath: /etc/ssl/certs</span></p>
<p></span></p>
<p>/etc/ssl/certs/ 里的文件，其实都是软链，软链到firefox 的证书目录吧，这个 /usr/share/ca-certificates/mozilla/ 。</p>
<p>既然如此，那我把cnnic root 的证书扔进去，总可以了吧？结果发现，还是不行的，难道是名字也有要求？格式不对？</p>
<p><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace;"><span style="line-height: 18px; white-space: pre;">2，朋友用mba 的curl 帮我测试，是正常的，是因为cnnic 的root 证书在信任列表吗？日后入手了mbp 再测试！</span></span></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.helosa.org/2010/12/20/cnnic-https-cert.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<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>

