2008年10月12日 星期日

lighttpd上設定過期時間

lighttpd也是web server的一種,還不錯用呢!
(真希望虛擬主機是提供lighttpd)
設定過期時間的由來,請參考
Apache上設定過期時間


FreeBSD的設定檔通常是在 /usr/local/etc/lighttpd.conf
mod_expired要先設
server.modules = (
"mod_expire"
)

通常這會有很多項目,把前面的#拿掉就會開啟。

再來設定,這是範例,請自行修改哦!
$HTTP["host"] == "dev.sopili.net" {
server.document-root = "/home/www/my_project"
$HTTP["url"] =~ "\.(js|gif|jpg|jpeg|png|htm|html|xml|css|ico)$" {
expire.url = ( "" => "access 3 days" )
}
}


設定完記得要重啟web server
/usr/local/etc/rc.d/lighttpd restart