On twitter

RT @christiney35: 最近很多人介紹新朋友合作,真好。我也需要人家介紹 Python 工程師耶~快來吧,Python 工程師!! #fb

follow me on twitter

Posts Tagged ‘lighttpd’

lighttpd php backend overload 0

For the past few weeks, my lighttpd has crashed with error message “backend overload” almost once a day. I could not figure out where the problem was. After all, I switched APC to xCache, and this problem solved! :D Obviously, php crash is caused by APC.

May 31st, 2009 Programming Tags: , , ,

gamin circular dependency with ‘fam’ USE flag 0

gentoo linux 上應該是很少有機會會碰到 circular dependency, 如果真的碰到了, 就是過一陣子 emerge --sync 看看, 或是去作 bug report。 這次是為了要將 lighttpd 的 stat-cache-engine 設定為 fam, 而第一次碰到 portage 的 circular dependency。

嗯, 這個問題是發生在 gamin 跟 glib 這兩個套件, 其實之前一直放著不管, 就把時間拿去弄唱片了, 可是過了好久, 這個問題還沒解決, 一直到今天才又換了方法試一下, 沒想到就成功了!! :D

1. 首先 use flag 先不加 fam, 先把 glib 跟 gamin 裝上去

USE='-fam' emerge gamin
Read the rest of this entry »

October 24th, 2008 Linux Tags: , , , , , ,

[Lighttpd] get real IP from proxy 0

由於先前在測試用 nginx 放在原本的 lighttpd 前面作 load balance 還是 reverse proxy 什麼的, 不過因為完全沒碰過, 只能亂搞, 沒想到成功了 XD (雖然有設錯, 整個站有掛掉一下下)

本來是想說到時候 StickerAction 撐不住, 可以把 request 分到別台去, 不過看目前的情形都還撐得住, 最高也還沒到 20 req/s, 是我小看了 256slice 阿 ~”~ 不過應該也是因為加了之前做的, 讓圖片快取住的功能, 才能減少一些 request 的。

不過當時唯一有問題的就是, 當我再看 log 跟 session 的時候, 發現, ip 全部都是 127.0.0.1 阿!! :o 幸好之前程式中 session 沒有要 match ip XD 原來 lighttpd 那邊要開 mod_extforward 來取得 client 經過 nginx proxy 後, 原本的 IP 位址。

lighttpd 再 1.4.14 之後就都有 mod_extforward, 只是好像預設的 lighttpd.conf 都不會列出來。 所以只要再 server.modules 裡面載入 mod_extforward 就可以了, 只是記得要放在 mod_accesslog 後面載入, 如下:

server.modules = (
    "mod_rewrite",
    ...
    "mod_accesslog",
    "mod_extforward"
)

然後加上個相信的 IP 來源就可以啦 :D

extforward.forwarder = (
   "127.0.0.1" => "trust"
)

雖然也不知道放個 nginx 在前面有沒有發揮什麼作用就是了 XD anyway 至少之後可以直接把 request 分到另外一台

August 29th, 2008 Linux Tags: , , , ,

Lighttpd rewrite rules for CodeIgniter 2

由於 CodeIgniter 使用 index.php 當作 font controller, 所以基本上把所有的東西都 rewrite 到 index.php 就可以了! 不過由於還是有 images, js 跟 css 檔案不能做 rewrite, 所以再加上類似於 public 那一行就行了! (我習慣是把 images, js 跟 css 資料夾都放在 public 資料夾裡面)

$HTTP["host"] =~ "tzangms.com" {
    url.rewrite = (
        "^/public/.*$" => "$0",
        "^/(.*)$" => "index.php/$1"
    )
}
March 1st, 2008 CodeIgniter Tags: , , ,

lighttpd simple-vhost 設定 0

lighttpd 的 simple-vhost 設定還真是簡單阿~ XD

首先設定 server.modules 打開 mod_simple_vhost, 我的 server.modules 大概像這樣
[source:php]
server.modules = (
“mod_rewrite”,
“mod_access”,
“mod_auth”,
“mod_status”,
“mod_simple_vhost”,
“mod_compress”,
)
[/source]

然後設定下面這幾行, 就好了 :o
Read the rest of this entry »

January 22nd, 2008 Linux Tags:
Partners of Oceanic / 人生海海

jiwosca