<?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>網絡技術日誌</title>
	<atom:link href="http://www.hkcode.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.hkcode.com</link>
	<description>關於 PHP, Linux, Open Source 及個人生活記載的網誌。</description>
	<lastBuildDate>Tue, 03 Apr 2012 03:37:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Razo 鋁合金腳踏</title>
		<link>http://www.hkcode.com/driving/712</link>
		<comments>http://www.hkcode.com/driving/712#comments</comments>
		<pubDate>Tue, 03 Apr 2012 03:35:54 +0000</pubDate>
		<dc:creator>Sam Tang</dc:creator>
				<category><![CDATA[駕駛日誌]]></category>

		<guid isPermaLink="false">http://www.hkcode.com/?p=712</guid>
		<description><![CDATA[在車上安裝鋁合金腳踏，在我看來沒有甚麼實際用途，主要目的只為了提昇車箱內的美觀程度。原來在車上使用的腳踏是用鐵片夾實原廠腳踏，有一種不實在的感覺，在淘寶上面有很多款的 TRD 字款的 A 貨腳踏，連同運費二百元以下便買到，質感上也算 OK，但我不喜歡那些腳踏的原因，是要在原廠腳踏上鑽孔。 所以就去買了 Razo 的鋁合金腳踏回來，安裝上很簡單，只要用縲絲上實扣具就好。價錢比較貴, 要價 $390，但質量確實比一般的腳踏來得高。]]></description>
			<content:encoded><![CDATA[<p>在車上安裝鋁合金腳踏，在我看來沒有甚麼實際用途，主要目的只為了提昇車箱內的美觀程度。原來在車上使用的腳踏是用鐵片夾實原廠腳踏，有一種不實在的感覺，在淘寶上面有很多款的 TRD 字款的 A 貨腳踏，連同運費二百元以下便買到，質感上也算 OK，但我不喜歡那些腳踏的原因，是要在原廠腳踏上鑽孔。</p>
<p>所以就去買了 Razo 的鋁合金腳踏回來，安裝上很簡單，只要用縲絲上實扣具就好。價錢比較貴, 要價 $390，但質量確實比一般的腳踏來得高。</p>
<p><a href="/wp-content/uploads/2012/04/razo_rp121_pad.jpg" title="Razo RP 121"><img src="wp-content/uploads/2012/04/razo_rp121_pad-300x210.jpg" title="Razo RP 121"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hkcode.com/driving/712/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ScanGauge 走線安裝</title>
		<link>http://www.hkcode.com/driving/703</link>
		<comments>http://www.hkcode.com/driving/703#comments</comments>
		<pubDate>Wed, 25 Jan 2012 01:55:07 +0000</pubDate>
		<dc:creator>Sam Tang</dc:creator>
				<category><![CDATA[駕駛日誌]]></category>

		<guid isPermaLink="false">http://www.hkcode.com/?p=703</guid>
		<description><![CDATA[早前在淘寶買的 ScanGauge 很好用，但當初只是將它貼在標板下面，要看裡面的資訊很不方便，昨天將它安裝到安響的空格內，雖然不是很完美，但瀏覽資訊時就方便多了。]]></description>
			<content:encoded><![CDATA[<p>早前在淘寶買的 <a href="http://www.hkcode.com/driving/592">ScanGauge</a> 很好用，但當初只是將它貼在標板下面，要看裡面的資訊很不方便，昨天將它安裝到安響的空格內，雖然不是很完美，但瀏覽資訊時就方便多了。</p>
<p><img src="http://www.hkcode.com/wp-content/uploads/2012/01/2012-01-24_16-05-10_419-169x300.jpg" alt="ScanGauge Plus" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hkcode.com/driving/703/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>.htaccess – Invalid command &#8216;AuthUserFile&#8217; 錯誤</title>
		<link>http://www.hkcode.com/linux-bsd-notes/698</link>
		<comments>http://www.hkcode.com/linux-bsd-notes/698#comments</comments>
		<pubDate>Mon, 16 Jan 2012 22:42:08 +0000</pubDate>
		<dc:creator>Sam Tang</dc:creator>
				<category><![CDATA[Linux / BSD 筆記]]></category>

		<guid isPermaLink="false">http://www.hkcode.com/?p=698</guid>
		<description><![CDATA[在主機上的 Apache 用 .htaccess 設定了密碼保目錄，但發覺升級 Apache 後就出現 Internal Server Error，再查看 apache 的 error log，發現以下的錯誤訊息: .htaccess: Invalid command ‘AuthUserFile’, perhaps misspelled or defined by a module not included in the server configuration 解決方法只要開啟 httpd.conf 並開啟 authn_file module 便可以，打開 httpd.conf，找到 mod_authn_file 一行並將最開端的註釋符號刪除，改成: LoadModule authn_file_module modules/mod_authn_file.so 然後重新啟動 apache 便完成了。]]></description>
			<content:encoded><![CDATA[<p>在主機上的 Apache 用 .htaccess 設定了密碼保目錄，但發覺升級 Apache 後就出現 Internal Server Error，再查看 apache 的 error log，發現以下的錯誤訊息:</p>
<p><strong>.htaccess: Invalid command ‘AuthUserFile’, perhaps misspelled or defined by a module not included in the server configuration</strong></p>
<p>解決方法只要開啟 httpd.conf 並開啟 authn_file module 便可以，打開 httpd.conf，找到 mod_authn_file 一行並將最開端的註釋符號刪除，改成:</p>
<p><strong>LoadModule authn_file_module modules/mod_authn_file.so</strong></p>
<p>然後重新啟動 apache 便完成了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hkcode.com/linux-bsd-notes/698/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux 下找出體積最大的檔案/目錄</title>
		<link>http://www.hkcode.com/linux-bsd-notes/693</link>
		<comments>http://www.hkcode.com/linux-bsd-notes/693#comments</comments>
		<pubDate>Thu, 05 Jan 2012 00:58:34 +0000</pubDate>
		<dc:creator>Sam Tang</dc:creator>
				<category><![CDATA[Linux / BSD 筆記]]></category>

		<guid isPermaLink="false">http://www.hkcode.com/?p=693</guid>
		<description><![CDATA[當發現系統硬碟空間突然上升時，想知道那個檔案或目錄佔用最多空間，可以用 du + sort + head 指令完成，它們的作用分別為: du: 計算目錄所使用的空間 sort: 將輸入的資料排序 head: 將輸入資料的最開頭幾行資料輸出 假如發現 /home 裡面的空間使用異常時，可以用以下指令查看 /home 裡面頭 10 個使用最多硬碟空間的檔案或目錄: # du -a /home &#124; sort -n -r &#124; head -n 10]]></description>
			<content:encoded><![CDATA[<p>當發現系統硬碟空間突然上升時，想知道那個檔案或目錄佔用最多空間，可以用 du + sort + head 指令完成，它們的作用分別為:</p>
<p>du: 計算目錄所使用的空間<br />
sort: 將輸入的資料排序<br />
head: 將輸入資料的最開頭幾行資料輸出</p>
<p>假如發現 /home 裡面的空間使用異常時，可以用以下指令查看 /home 裡面頭 10 個使用最多硬碟空間的檔案或目錄:</p>
<div class="shell"># du -a /home | sort -n -r | head -n 10</div>
]]></content:encoded>
			<wfw:commentRss>http://www.hkcode.com/linux-bsd-notes/693/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL: [ERROR] Unknown character set 問題</title>
		<link>http://www.hkcode.com/linux-bsd-notes/687</link>
		<comments>http://www.hkcode.com/linux-bsd-notes/687#comments</comments>
		<pubDate>Sun, 01 Jan 2012 01:13:24 +0000</pubDate>
		<dc:creator>Sam Tang</dc:creator>
				<category><![CDATA[Linux / BSD 筆記]]></category>

		<guid isPermaLink="false">http://www.hkcode.com/?p=687</guid>
		<description><![CDATA[早前升級一台主機的 MySQL Server，升級後發現部份資料表無法開啟，報出的錯誤訊息是: Unknown character set: &#8216;BIG5&#8242; 出現這個問題的原因是新版本 MySQL 安裝時沒有安裝額外的字集，而對上一個版本的 MySQL 是用 YUM 安裝，所有透過套件工具安裝的 MySQL 也會預設安裝所有字集，解決方法是重新編譯 MySQL 並加上所有的字集的選擇 &#8211;with-extra-charsets=complex，編譯語法如下: ./configure &#8212; prefix=/usr/local/mysql &#8211;with-extra-charsets=complex 如果在 FreeBSD 遇上這個問題，而 FreeBSD 內的 MySQL 是透過 ports 安裝的話，便要使用 WITH_XCHARSET=all 參數: make WITH_XCHARSET=all install clean]]></description>
			<content:encoded><![CDATA[<p>早前升級一台主機的 MySQL Server，升級後發現部份資料表無法開啟，報出的錯誤訊息是:</p>
<p>Unknown character set: &#8216;BIG5&#8242;</p>
<p>出現這個問題的原因是新版本 MySQL 安裝時沒有安裝額外的字集，而對上一個版本的 MySQL 是用 YUM 安裝，所有透過套件工具安裝的 MySQL 也會預設安裝所有字集，解決方法是重新編譯 MySQL 並加上所有的字集的選擇 &#8211;with-extra-charsets=complex，編譯語法如下:</p>
<p>./configure &#8212; prefix=/usr/local/mysql &#8211;with-extra-charsets=complex</p>
<p>如果在 FreeBSD 遇上這個問題，而 FreeBSD 內的 MySQL 是透過 ports 安裝的話，便要使用 WITH_XCHARSET=all 參數:</p>
<p>make WITH_XCHARSET=all install clean</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hkcode.com/linux-bsd-notes/687/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>汽車保養週期</title>
		<link>http://www.hkcode.com/driving/676</link>
		<comments>http://www.hkcode.com/driving/676#comments</comments>
		<pubDate>Wed, 28 Dec 2011 07:26:09 +0000</pubDate>
		<dc:creator>Sam Tang</dc:creator>
				<category><![CDATA[駕駛日誌]]></category>

		<guid isPermaLink="false">http://www.hkcode.com/?p=676</guid>
		<description><![CDATA[這是根據我自己的駕駛習慣整理出來的汽車保養週期，駕駛模式大約為 70% highway, 30% 市區，大多情況都不會滿坐，並溫和駕駛。這個保養週期會根據車種的不同及駕駛風格而有所區別: 機油及機油濾芯: 5000KM 或半年 ATF 波箱油: 20000KM 或 1 年 波箱隔: 50000KM 火咀: 15000KM (白金及長效型銥金可 100000KM 才換，競技型銥金則 20000KM) 風隔(空氣濾芯): 5000KM 水箱水: 20000KM 或 1 年 煞車油: 20000KM 或 2 年 電油隔(汽油濾芯): 50000KM]]></description>
			<content:encoded><![CDATA[<p>這是根據我自己的駕駛習慣整理出來的汽車保養週期，駕駛模式大約為 70% highway, 30% 市區，大多情況都不會滿坐，並溫和駕駛。這個保養週期會根據車種的不同及駕駛風格而有所區別:</p>
<p>機油及機油濾芯: 5000KM 或半年<br />
ATF 波箱油: 20000KM 或 1 年<br />
波箱隔: 50000KM<br />
火咀: 15000KM (白金及長效型銥金可 100000KM 才換，競技型銥金則 20000KM)<br />
風隔(空氣濾芯): 5000KM<br />
水箱水: 20000KM 或 1 年<br />
煞車油: 20000KM 或 2 年<br />
電油隔(汽油濾芯): 50000KM</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hkcode.com/driving/676/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux 下編譯 Apache 的 mod_rewrite</title>
		<link>http://www.hkcode.com/linux-bsd-notes/658</link>
		<comments>http://www.hkcode.com/linux-bsd-notes/658#comments</comments>
		<pubDate>Wed, 28 Dec 2011 01:05:00 +0000</pubDate>
		<dc:creator>Sam Tang</dc:creator>
				<category><![CDATA[Linux / BSD 筆記]]></category>

		<guid isPermaLink="false">http://www.hkcode.com/?p=658</guid>
		<description><![CDATA[要為 Apache 加載 mod_rewrite 模組，如果 Apache 並未安裝，可以在編譯時加上 &#8211;enable-rewrite 便可以，但如果 Apache 已經安裝好，而又不想重新編譯 Apache 的話，可以用以下方法: 1. 首先 cd 到 Apache 的源代碼目錄並到 mod_rewrite.c 檔案， 1. 在apache的源码安装目录中寻找mod_rewrite.c文件 # find ./ -name mod_rewrite.c &#160; 　　 2. 進入 mod_rewrite.c 的目錄並用 apxs 編譯 mod_rewrite.c # cd PATH/to/mod_rewrite.c # /usr/local/apache/bin/apxs -c mod_rewrite.c # /usr/local/apache/bin/apxs -i -a -n mod_rewrite mod_rewrite.la &#160; 3. 編譯好 mod_rewrite.c [...]]]></description>
			<content:encoded><![CDATA[<p>要為 Apache 加載 mod_rewrite 模組，如果 Apache 並未安裝，可以在編譯時加上 &#8211;enable-rewrite 便可以，但如果 Apache 已經安裝好，而又不想重新編譯 Apache 的話，可以用以下方法:</p>
<p>1. 首先 cd 到 Apache 的源代碼目錄並到 mod_rewrite.c 檔案，</p>
<p>1. 在apache的源码安装目录中寻找mod_rewrite.c文件</p>
<div class="shell"># find ./ -name mod_rewrite.c</div>
<p>&nbsp;<br />
　　<br />
2. 進入 mod_rewrite.c 的目錄並用 apxs 編譯 mod_rewrite.c</p>
<div class="shell"># cd PATH/to/mod_rewrite.c<br />
# /usr/local/apache/bin/apxs -c mod_rewrite.c<br />
# /usr/local/apache/bin/apxs -i -a -n mod_rewrite mod_rewrite.la</div>
<p>&nbsp;</p>
<p>3. 編譯好 mod_rewrite.c 後，便開啟 httpd.conf 加入以下內容:</p>
<p>LoadModule rewrite_module modules/mod_rewrite.so</p>
<p>然後重新啟動 Apache 便可以了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hkcode.com/linux-bsd-notes/658/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Centos 安裝及設定 MRTG</title>
		<link>http://www.hkcode.com/linux-bsd-notes/656</link>
		<comments>http://www.hkcode.com/linux-bsd-notes/656#comments</comments>
		<pubDate>Thu, 22 Dec 2011 00:31:39 +0000</pubDate>
		<dc:creator>Sam Tang</dc:creator>
				<category><![CDATA[Linux / BSD 筆記]]></category>

		<guid isPermaLink="false">http://www.hkcode.com/?p=656</guid>
		<description><![CDATA[MRTG 是一套十分出名的網路流量監察工具，它會透過 SNMP 協定取得網路流量資料，並以網頁介面輸出。要安裝 MRTG，需要安裝以下套件: mrtg: MRTG 的主程式 net-snmp: NET-SNMP 內建幾個 SNMP 工具，包括 snmpd 及 snmptrapd daemons 及文檔等。 net-snmp-utils: 內建一些 NET-SNMP 工具。 以下是在 Centos 安裝及設定 MRTG 的步驟: 1. 安裝 MRTG: 在 Centos 下輸入以下指令安裝所需套件: # yum install mrtg net-snmp net-snmp-utils &#160; 2. 設定 SNMP: 開啟 /etc/snmp/snmpd.conf，加入以下下一行: rocommunity mrtg 儲存好 snmpd.conf 後重新啟動，並設定系統自動啟動 snmpd: # chkconfig snmpd on [...]]]></description>
			<content:encoded><![CDATA[<p>MRTG 是一套十分出名的網路流量監察工具，它會透過 SNMP 協定取得網路流量資料，並以網頁介面輸出。要安裝 MRTG，需要安裝以下套件:</p>
<p>mrtg: MRTG 的主程式<br />
net-snmp: NET-SNMP 內建幾個 SNMP 工具，包括 snmpd 及 snmptrapd daemons 及文檔等。<br />
net-snmp-utils: 內建一些 NET-SNMP 工具。</p>
<p>以下是在 Centos 安裝及設定 MRTG 的步驟:</p>
<p><strong>1. 安裝 MRTG:</strong></p>
<p>在 Centos 下輸入以下指令安裝所需套件:</p>
<div class="shell"># yum install mrtg net-snmp net-snmp-utils</div>
<p>&nbsp;<br />
<strong>2. 設定 SNMP:</strong><br />
開啟 /etc/snmp/snmpd.conf，加入以下下一行:<span id="more-656"></span></p>
<p><strong>rocommunity mrtg</strong></p>
<p>儲存好 snmpd.conf 後重新啟動，並設定系統自動啟動 snmpd:</p>
<div class="shell"># chkconfig snmpd on<br />
# /etc/rc.d/init.d/snmpd restart</div>
<p>&nbsp;</p>
<p><strong>3. 設定 MRTG</strong></p>
<p>安裝 MRTG 後，要用 cfgmaker 工具建立 /etc/mrtg/mrtg.cfg 檔案，方法如下:</p>
<div class="shell"># cfgmaker &#8211;global &#8216;WorkDir: /var/www/mrtg&#8217; &#8211;output /etc/mrtg/mrtg.cfg mrtg@localhost</div>
<p>&nbsp;<br />
下面的指令會建立 /etc/mrtg/mrtg.cnf 檔案，/var/www/mrtg 為 MRTG 在網頁伺服器的工作目錄，會儲存輸出的 html 及 png 圖像檔案。而 public@localhost 的 public 是在 snmpd.conf 設定的 community name，而 localhost 則是要監察的主機。</p>
<p>然後要執行 indexmaker 建立顯示流量的網頁檔案:</p>
<div class="shell"># indexmaker &#8211;output=/var/www/mrtg/index.html /etc/mrtg/mrtg.cfg</div>
<p>&nbsp;<br />
<strong>4. 用 Crontab 自動更新流量狀態</strong></p>
<p>在 crontab 加入以下一行，MRTG 便會每 5 分鐘更新一次:</p>
<p>*/5 * * * * /usr/bin/mrtg /etc/mrtg/mrtg.cfg</p>
<p>要查看 MRTG 報表，就可以用以下網址，其中 localhost 要換成主機的 hostname:</p>
<p>http://localhost/mrtg/</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hkcode.com/linux-bsd-notes/656/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>service httpd does not support chkconfig 問題</title>
		<link>http://www.hkcode.com/linux-bsd-notes/638</link>
		<comments>http://www.hkcode.com/linux-bsd-notes/638#comments</comments>
		<pubDate>Tue, 20 Dec 2011 23:38:20 +0000</pubDate>
		<dc:creator>Sam Tang</dc:creator>
				<category><![CDATA[Linux / BSD 筆記]]></category>

		<guid isPermaLink="false">http://www.hkcode.com/?p=638</guid>
		<description><![CDATA[在 Redhat 或 Centos 下手動編譯安裝 Apache 後，將 apachectl 放到 init.d 裡面，然後用 chkconfig 自動啟動，即以下動作會得出 service httpd does not support chkconfig 錯誤: # cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd chkconfig httpd on &#160; service httpd does not support chkconfig 解決方法是開啟 /etc/rc.d/init.d/httpd，把以下兩行加入到第二行便完成了。 # chkconfig: 35 85 15 # description: Apache is a World Wide Web server.]]></description>
			<content:encoded><![CDATA[<p>在 Redhat 或 Centos 下手動編譯安裝 Apache 後，將 apachectl 放到 init.d 裡面，然後用 chkconfig 自動啟動，即以下動作會得出 service httpd does not support chkconfig 錯誤:</p>
<div class="shell"># cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd<br />
chkconfig httpd on</div>
<p>&nbsp;<br />
<strong>service httpd does not support chkconfig</strong></p>
<p>解決方法是開啟 /etc/rc.d/init.d/httpd，把以下兩行加入到第二行便完成了。</p>
<p># chkconfig: 35 85 15<br />
# description: Apache is a World Wide Web server.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hkcode.com/linux-bsd-notes/638/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Redhat/Centos 架設 DNS Server</title>
		<link>http://www.hkcode.com/linux-bsd-notes/636</link>
		<comments>http://www.hkcode.com/linux-bsd-notes/636#comments</comments>
		<pubDate>Mon, 19 Dec 2011 02:34:31 +0000</pubDate>
		<dc:creator>Sam Tang</dc:creator>
				<category><![CDATA[Linux / BSD 筆記]]></category>

		<guid isPermaLink="false">http://www.hkcode.com/?p=636</guid>
		<description><![CDATA[安裝環境 Centos 5.7 http://yacnoss.blogspot.com/2008/07/dnsbind.html 1. 安裝 DNS 所需套件: 只要用 yum 指令便可以一次過想所需的套件安裝。 # yum install bind bind-chroot bind-utils caching-nameserver &#160; 在預設的情況下 Centos 不會建立 named.conf，要用以下方法建立: # cd /etc grep -v &#8216;//&#8217; named.rfc1912.zones > named.conf chown root.named named.conf chmod 640 named.conf &#160; 2. 更新 root.zone 到 ftp://rs.internic.net/domain/root.zone 下載最新的 root.zone 資料檔，然後放到 /var/named/var/named/ 裡面。 然後就可以用 /etc/rc.d/init.d/named start 啟動 DNS Server。 [...]]]></description>
			<content:encoded><![CDATA[<p>安裝環境 Centos 5.7</p>
<p>http://yacnoss.blogspot.com/2008/07/dnsbind.html</p>
<p><strong>1. 安裝 DNS 所需套件:</strong><br />
只要用 yum 指令便可以一次過想所需的套件安裝。</p>
<div class="shell"># yum install bind bind-chroot bind-utils caching-nameserver</div>
<p>&nbsp;<br />
在預設的情況下 Centos 不會建立 named.conf，要用以下方法建立:</p>
<div class="shell"># cd /etc<br />
grep -v &#8216;//&#8217; named.rfc1912.zones > named.conf<br />
chown root.named named.conf<br />
chmod 640 named.conf</div>
<p>&nbsp;</p>
<p><strong>2. 更新 root.zone</strong></p>
<p>到 ftp://rs.internic.net/domain/root.zone 下載最新的 root.zone 資料檔，然後放到 /var/named/var/named/ 裡面。</p>
<p>然後就可以用 /etc/rc.d/init.d/named start 啟動 DNS Server。</p>
<p>啟動後可以輸入以入指令測試 DNS Server 是否正常運作:</p>
<div class="shell"># dig www.google.com @127.0.0.1</div>
<p>&nbsp;<br />
關於在 DNS Server 加入 zone 及其他設定，可以參考以下文章:<br />
<a href="http://linux.vbird.org/linux_server/0350dns.php" target="_blank">http://linux.vbird.org/linux_server/0350dns.php</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hkcode.com/linux-bsd-notes/636/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux &#8212; 將一個用戶的進程全部 kill 掉</title>
		<link>http://www.hkcode.com/linux-bsd-notes/632</link>
		<comments>http://www.hkcode.com/linux-bsd-notes/632#comments</comments>
		<pubDate>Mon, 19 Dec 2011 00:09:47 +0000</pubDate>
		<dc:creator>Sam Tang</dc:creator>
				<category><![CDATA[Linux / BSD 筆記]]></category>

		<guid isPermaLink="false">http://www.hkcode.com/?p=632</guid>
		<description><![CDATA[當某個用戶使用過多系統資源時，可以用以下指令將他開啟的所有進程 kill 掉: kill -9 `ps -u USERNAME -o &#8220;pid=&#8221;` 使用上只要將以上指令的 USERNAME 改成用戶名稱。]]></description>
			<content:encoded><![CDATA[<p>當某個用戶使用過多系統資源時，可以用以下指令將他開啟的所有進程 kill 掉:</p>
<p>kill -9 `ps -u USERNAME -o &#8220;pid=&#8221;`</p>
<p>使用上只要將以上指令的 USERNAME 改成用戶名稱。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hkcode.com/linux-bsd-notes/632/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Redhat/Centos Yum 安裝 MySQL 問題</title>
		<link>http://www.hkcode.com/linux-bsd-notes/627</link>
		<comments>http://www.hkcode.com/linux-bsd-notes/627#comments</comments>
		<pubDate>Fri, 16 Dec 2011 01:05:42 +0000</pubDate>
		<dc:creator>Sam Tang</dc:creator>
				<category><![CDATA[Linux / BSD 筆記]]></category>

		<guid isPermaLink="false">http://www.hkcode.com/?p=627</guid>
		<description><![CDATA[今日在一台伺服器上升級 PHP 的版本，伺服器原來已經用 Yum 安裝了 MySQL，在手動編譯 PHP 時一直出現以下錯誤訊息: configure: error: mysql configure failed. Please check config.log for more information. 原來我在編譯 PHP 時用了錯誤的參數，原本我是用 &#8220;&#8211;with-mysql=/usr/&#8221;，要將這個參數改成 &#8220;&#8211;with-mysql-dir=/usr/&#8221; 才可以編譯成功。]]></description>
			<content:encoded><![CDATA[<p>今日在一台伺服器上升級 PHP 的版本，伺服器原來已經用 Yum 安裝了 MySQL，在手動編譯 PHP 時一直出現以下錯誤訊息:</p>
<p>configure: error: mysql configure failed. Please check config.log for more information.</p>
<p>原來我在編譯 PHP 時用了錯誤的參數，原本我是用 &#8220;&#8211;with-mysql=/usr/&#8221;，要將這個參數改成 &#8220;&#8211;with-mysql-dir=/usr/&#8221; 才可以編譯成功。 </p>
]]></content:encoded>
			<wfw:commentRss>http://www.hkcode.com/linux-bsd-notes/627/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>找出隱藏的 process 及 port</title>
		<link>http://www.hkcode.com/linux-bsd-notes/615</link>
		<comments>http://www.hkcode.com/linux-bsd-notes/615#comments</comments>
		<pubDate>Wed, 14 Dec 2011 23:30:48 +0000</pubDate>
		<dc:creator>Sam Tang</dc:creator>
				<category><![CDATA[Linux / BSD 筆記]]></category>

		<guid isPermaLink="false">http://www.hkcode.com/?p=615</guid>
		<description><![CDATA[很多 rootkits 用了一些隱藏技巧，用 netstat 也找不出來，這個時候可以用 chkrootkit 這類工具掃瞄，另外還可以用 Unhide 搜索是否有不尋常的 process 及 port。 Unhide 是一個輕巧的安全工具，可以找出 rootkit 所開啟的 process 或 TCP/UDP ports，除了 Unix 版本外，它還有 Windows 版本。 如果是使用 Redhat，可以到 pkgs.org 下載相應版本的 rpm 檔案裝。 在 Debian / Ubuntu 則較簡單，用 apt-get 安裝就好了。 # apt-get install unhide 至於使用上也是很簡單，一般上以下幾個指令就會搜索系統內隱藏的 process 及 ports: # unhide-posix proc # unhide-posix sys # unhide-tcp]]></description>
			<content:encoded><![CDATA[<p>很多 rootkits 用了一些隱藏技巧，用 netstat 也找不出來，這個時候可以用 <a href="http://www.hkcode.com/linux-bsd-notes/172">chkrootkit</a> 這類工具掃瞄，另外還可以用 Unhide 搜索是否有不尋常的 process 及 port。<br />
Unhide 是一個輕巧的安全工具，可以找出 rootkit 所開啟的 process 或 TCP/UDP ports，除了 Unix 版本外，它還有 Windows 版本。</p>
<p>如果是使用 Redhat，可以到 <a href="http://pkgs.org/download/unhide" title="unhide" target="_blank">pkgs.org</a> 下載相應版本的 rpm 檔案裝。</p>
<p>在 Debian / Ubuntu 則較簡單，用 apt-get 安裝就好了。</p>
<div class="shell"># apt-get install unhide</div>
<p>至於使用上也是很簡單，一般上以下幾個指令就會搜索系統內隱藏的 process 及 ports:</p>
<div class="shell"># unhide-posix proc<br />
# unhide-posix sys<br />
# unhide-tcp</div>
]]></content:encoded>
			<wfw:commentRss>http://www.hkcode.com/linux-bsd-notes/615/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>升級 WordPress 後的亂碼問題</title>
		<link>http://www.hkcode.com/internet-notes/604</link>
		<comments>http://www.hkcode.com/internet-notes/604#comments</comments>
		<pubDate>Mon, 12 Dec 2011 02:45:44 +0000</pubDate>
		<dc:creator>Sam Tang</dc:creator>
				<category><![CDATA[互聯網筆記]]></category>

		<guid isPermaLink="false">http://www.hkcode.com/?p=604</guid>
		<description><![CDATA[昨天將 WordPress 從 2.0.x 升級到 3.2.1 後發覺全站的中文變成亂碼，但恢復舊版本的 WordPress 又可以正常顯示，那就是設定的問題。 最根本的問題是原來的資料使用 latin 1 編碼，而 WordPress 預設是使用 UTF8 編碼，要徹底解決就要用 mysqldump 將資料匯出並修改編碼。 但不想這麼麻煩，反正一直用得好好的，找到一個最簡單的方法是開啟 wp-config.php，找到以下兩行然後注釋掉: // define(&#8216;DB_CHARSET&#8217;, &#8216;utf8&#8242;); // define(&#8216;DB_COLLATE&#8217;, &#8221;);]]></description>
			<content:encoded><![CDATA[<p>昨天將 WordPress 從 2.0.x 升級到 3.2.1 後發覺全站的中文變成亂碼，但恢復舊版本的 WordPress 又可以正常顯示，那就是設定的問題。</p>
<p>最根本的問題是原來的資料使用 latin 1 編碼，而 WordPress 預設是使用 UTF8 編碼，要徹底解決就要用 mysqldump 將資料匯出並修改編碼。</p>
<p>但不想這麼麻煩，反正一直用得好好的，找到一個最簡單的方法是開啟 wp-config.php，找到以下兩行然後注釋掉:</p>
<p>// define(&#8216;DB_CHARSET&#8217;, &#8216;utf8&#8242;);<br />
// define(&#8216;DB_COLLATE&#8217;, &#8221;);</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hkcode.com/internet-notes/604/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP 取得用戶真實 IP</title>
		<link>http://www.hkcode.com/programming/602</link>
		<comments>http://www.hkcode.com/programming/602#comments</comments>
		<pubDate>Mon, 12 Dec 2011 01:02:43 +0000</pubDate>
		<dc:creator>Sam Tang</dc:creator>
				<category><![CDATA[程式設計分享]]></category>

		<guid isPermaLink="false">http://www.hkcode.com/programming/602</guid>
		<description><![CDATA[要用 PHP 取得用戶的 IP 十分容易，只要用 $_SERVER['REMOTE_ADDR'] 變數就可以知道用戶的 IP，但如果用戶使用了 proxy server 上網的話，$_SERVER['REMOTE_ADDR'] 只會得到 proxy 的 IP 地址。 以下方法會使用 $_SERVER["HTTP_CLIENT_IP"] 及 $_SERVER["HTTP_X_FORWARDED_FOR"] 解決這個問題: PLAIN TEXT PHP: &#60;?php if &#40;!empty&#40;$_SERVER&#91;"HTTP_CLIENT_IP"&#93;&#41;&#41;&#123; &#160; &#160; $ip = $_SERVER&#91;"HTTP_CLIENT_IP"&#93;; &#125;elseif&#40;!empty&#40;$_SERVER&#91;"HTTP_X_FORWARDED_FOR"&#93;&#41;&#41;&#123; &#160; &#160; $ip = $_SERVER&#91;"HTTP_X_FORWARDED_FOR"&#93;; &#125;else&#123; &#160; &#160; $ip = $_SERVER&#91;"REMOTE_ADDR"&#93;; &#125; &#160; echo $ip; ?&#62;]]></description>
			<content:encoded><![CDATA[<p>要用 PHP 取得用戶的 IP 十分容易，只要用 $_SERVER['REMOTE_ADDR'] 變數就可以知道用戶的 IP，但如果用戶使用了 proxy server 上網的話，$_SERVER['REMOTE_ADDR'] 只會得到 proxy 的 IP 地址。</p>
<p>以下方法會使用 $_SERVER["HTTP_CLIENT_IP"] 及 $_SERVER["HTTP_X_FORWARDED_FOR"] 解決這個問題:</p>
<div class="igBar"><span id="lphp-2"><a href="#" onclick="javascript:showPlainTxt('php-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-2">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>!<a href="http://www.php.net/empty"><span style="color:#000066;">empty</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$_SERVER</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">"HTTP_CLIENT_IP"</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$ip</span> = <span style="color:#0000FF;">$_SERVER</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">"HTTP_CLIENT_IP"</span><span style="color:#006600; font-weight:bold;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#616100;">elseif</span><span style="color:#006600; font-weight:bold;">&#40;</span>!<a href="http://www.php.net/empty"><span style="color:#000066;">empty</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$_SERVER</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">"HTTP_X_FORWARDED_FOR"</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$ip</span> = <span style="color:#0000FF;">$_SERVER</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">"HTTP_X_FORWARDED_FOR"</span><span style="color:#006600; font-weight:bold;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$ip</span> = <span style="color:#0000FF;">$_SERVER</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">"REMOTE_ADDR"</span><span style="color:#006600; font-weight:bold;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#0000FF;">$ip</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hkcode.com/programming/602/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

