Tim K.C. Leung & Sin Y.S. Tin
 

Discuz論壇 初步靜態化教學

by Tim on Apr.26, 2010, under 電腦

  1. create .htaccess in the root directory of Discuz
  2. RewriteEngine on
    RewriteRule ^archiver/((fid|tid)-[\w\-]+\.html)$ archiver/index.php?$1
    RewriteRule ^forum-([0-9]+)-([0-9]+)\.html$ forumdisplay.php?fid=$1&page=$2
    RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ viewthread.php?tid=$1&extra=page\%3D$3&page=$2
    RewriteRule ^space-(username|uid)-(.+)\.html$ space.php?$1=$2
    RewriteRule ^tag-(.+)\.html$ tag.php?name=$1
  3. 到論壇後台全局→優化設置→URL 靜態化:、Rewrite 兼容性 開啟。
  4. 更新緩存。然後我們可以到論壇隨意點一個頁面進入看網址是否已變成靜態化(等個1~3秒才會變化)

Reference:

http://bbs.goodideaa.com/thread-2522-1-1.html

Leave a Comment more...

Dell 2950 Dual E5420 + CentOS + KVM + Eth0 Bridge Mode

by Tim on Apr.07, 2010, under Linux, Networking, 電腦

今日代人入手 Dell 2950 , 拎完番來即”操”佢.

玩完佢個DRAC5 後,  就即安OS

安過VMware ESXi (但用Client 連線失敗), 之後都係直接安CentOS 5.4 64bit.

再玩Virtual Machine – KVM. 先係安個XP, 再安VISTA, 再安CentOS.
但發現Win XP 運行時係會拎個分俾佢用的CPU Full Loading. 但CentOS 又冇事.
找一找RH Doc, 佢話:
“Windows XP 32-BitOptimized with para-virtualized drivers (network driver only)”
咁我一心以為係死証, 就暫時冇搞XP, 去玩番KVM 下的CentOS.

KVM下的CentOS速度上也唔係慢太多. 運行
“ab -c 1000 -n 10000 http://127.0.0.1/phpinfo.php” 和非VM 也只是大約10%-20%之差.

再之後就請教左M群的LazyFai 兄有關Win XP @ KVM Full Loading CPU 問題, 佢也找了一陣, 替我CHECK 了一陣, 之後俾我地發現了原來係因為 KVM 運行XP 時正常係會以HAL Mode 運行, 從而導致CPU Loading 誤報問題
解決方法係在安XP 前要在其設定檔中加入acpi 設定:

vi /etc/libvirt/qemu/xxxx.xml
在 中加入
<acpi/>
<apic/>
便可以進行安裝XP

再者, 如果需要VM所用的NETWORK 有如直接連接到主網絡的話, 便需要設定最少一個Network Interface為Bridge Mode.
設定如下:

# Disable NetworkManager
chkconfig NetworkManager off
chkconfig network on
service NetworkManager stop
service network start

# Creating network initscripts
cd /etc/sysconfig/network-scripts
vi ifcfg-ethX

DEVICE=eth0
# change the hardware address to match the hardware address your NIC uses
HWADDR=00:16:76:D6:C9:45
ONBOOT=yes
BRIDGE=br0

vi ifcfg-br0
DEVICE=br0
TYPE=Bridge
BOOTPROTO=dhcp
ONBOOT=yes
DELAY=0

service network restart

# Forward All bridge traffic OR Disable iptables on bridges

iptables -I FORWARD -m physdev --physdev-is-bridged -j ACCEPT
service iptables save
service iptables restart


vi /etc/sysctl.conf
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
sysctl -p /etc/sysctl.conf

# Restart the libvirt daemon.
service libvirtd reload

# Verify Bridge Setting
brctl show

# Change VM to Bridge Interface
By GUI Remove Interface and Add new interface with bridged ethX
OR
Modifiy the VM’s xml “interface type” part

<interface type='bridge'>
<mac address='xx:xx:xx:xx:xx:xx' />
<source bridge='br0' />
</interface>

之後就再參考RH DOC 吧.

Reference:
Dell 2950
KVM VM Setting Sample
Red Hat Enterprise Linux 5 – Virtualization Guide

Leave a Comment :, , , , , , , more...

Exim is taking apache port

by Tim on Mar.14, 2010, under Linux

近日同個客CHECK機, 佢話個APACHE 時唔時就會死, 連唔上.
一CHECK 之下, 竟然係MAIL SERVER -EXIM 拎了個port 80 來做野. 真係奇怪.

經過一番google 及check 機後, 得出的結論係:

SERVER 軟件中, MOD_PHP / 其他plugin 在CALL mail() 的時候, 會因為apr 內的BUG 導致死HTTPD
而且會自動替換角色. 由原先HTTPD 所持有的PID 會轉為EXIM 所擁有. 同時佔用port 80

解決方法為: 升級apr 到1.3.6 或以上.

Server Config:
CentOS 4.6 x86_64
apr 0.9.4-24.9.el4_8.2
apache 2.2.x
php 5.2.x

Reference Link:
https://issues.apache.org/bugzilla/show_bug.cgi?id=43965 – “This has been fixed in apr 1.3.6″
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=366124

Leave a Comment more...

Dream Girl?

by Tim on Mar.12, 2010, under 情心蜜蜜, 生活

你问点解佢哋同完美有距离
咁你问问自己係咪正到晕嘅gentlemen
女人见到我哋米一样惊到晕
唔嫌弃我哋已经係完美嘅女人

Leave a Comment more...

[HOWTO] Squid proxy authentication using ncsa_auth helper

by Tim on Mar.08, 2010, under Linux

其實都俾人ORDER 咗好耐要做的事來了. 但遲遲未做起.. 今次一次過搞好VNC & PROXY AUTHENTICATION, 心情也不錯!

Following are included by default in most squid and most Linux distros:
=> NCSA: Uses an NCSA-style username and password file.
=> LDAP: Uses the Lightweight Directory Access Protocol
=> MSNT: Uses a Windows NT authentication domain.
=> PAM: Uses the Linux Pluggable Authentication Modules scheme.
=> SMB: Uses a SMB server like Windows NT or Samba.
=> getpwam: Uses the old-fashioned Unix password file.
=> SASL: Uses SALS libraries.
=> NTLM, Negotiate and Digest authentication

Step #1: Create a username/password
htpasswd /etc/squid/passwd user1
Stop #2: Check the location of ncsa_auth
rpm -ql squid | grep ncsa_auth
Step # 3: Configure nsca_auth for squid proxy authentication
vi /etc/squid/squid.conf
auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/passwd
auth_param basic children 5
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 2 hours
auth_param basic casesensitive off

acl ncsa_users proxy_auth REQUIRED
http_access allow ncsa_users

/etc/init.d/squid restart

Finial Result:

Leave a Comment more...

[Problem] Atheros Lan Drivers Installation in CentOS 5.4 x_64

by Tim on Mar.06, 2010, under Linux, Networking

During the installation of a new server, I faced the problem about installing the linux driver of Atheros Lan Driver.

It showed
kcompat.h:1561:error redefinition of 'struct napi_struct'
and stopped installation.

############# Solution ##############
I solved it by deleting some code in kcompat.h
the following were deleted
#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) )
/* NAPI API changes in 2.6.24 break everything */
struct napi_struct {
/* used to look up the real NAPI polling routine */
int (*poll)(struct napi_struct *, int);
int weight;
};

and


#endif /* _KCOMPAT_H_ */

Leave a Comment more...

自家設計 啜咪遲 鬆弛熊 抱枕 枕頭 坐墊 cushion 結婚整蠱情人生日禮物聖誕抽獎

by Tim on Feb.22, 2010, under 未分類

自家設計 啜咪遲 鬆弛熊 抱枕 枕頭 坐墊 cushion 結婚整蠱情人生日禮物聖誕抽獎

http://hk.f1.page.auctions.yahoo.com/hk/auction/1122961877?r=1044979438

Leave a Comment more...

09-10年度年宵企劃 啜咪遲: 我地心中團火, 係唔會熜架!

by Tim on Feb.01, 2010, under 未分類

2009年6月18日上廣州完成首要工作 – 尋找二線貨 後 , 我地再以我地的行動去證明我地的決心!

<-去片->

Leave a Comment more...

土瓜灣塌樓意外,慘劇中居民發揮互助精神

by Tim on Jan.30, 2010, under 生活

獨居於相鄰唐樓五樓的湯婆婆,看到塌樓後牆身出現大洞及震盪,
「當時好驚,即刻有人拍門,原來係住隔籬房嘅後生仔」。

青年帶著湯婆婆逃生,發現廚房尚算穩固,一起在該處躲避。
湯婆婆記得青年安慰她﹕「佢叫我唔使驚,話死都一齊死,我好感動!

其後消防員升起雲梯,青年立即揮手示意,還讓婆婆先逃生,
兩人互相扶持下終一起逃出險境。

Leave a Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...