jigen studylog » サーバ管理

jigen, Hirotomo Kunimatsu
Tokyo, Japan
mailto: microformat hcard
Page 1 of 41234
top

lighttpd のログ設定

lighttpd のログ設定以前、lighttpdでURLをrewriteというエントリーで、lighttpdヴァーチャルホストの設定とURLリライトルールに関して書いたけど、アクセスログエラーログの設定が微妙に調べ切れなかったので、ちょっと調べてみた。

結局、設定名がエラーログと、アクセスログとで違う所が分かりにくくしている原因だった。

ここら辺に書いてあるんだけど、「accesslog.filename」をそのまま「error.filename」とかにするとエラーが出る。んで色々調べた結果「server.errorlog」という名前で設定すれば良かった。

以下に一応設定を書いておく、カスタムログの形式もここに書けるみたい。

$HTTP["host"] =~ "host\.example\.com" {
    accesslog.format = "%h %l %u %t \"%r\" %b %>s \"%{Referer}i\" \"%{User-Agent}i\" \"%{X-LIGHTTPD-SID}o\"",
    server.document-root = "/path/to/document-root/",
    server.errorlog = "/path/to/error.log",
    accesslog.filename = "/path/to/access.log",
    url.rewrite-once = (
        "^/css/(.+)?$" => "$0",
        "^/img/(.+)?$" => "$0",
        "^/(.+)?$" => "/index.php/$1"
    )
}

整理しておこう

アクセスログ
accesslog.filename = “/path/to/access.log” の形式で書く
エラーログ
server.errorlog = “/path/to/error.log” の形式で書く

というか、命名ルールをもうちょっと考えて欲しかったなぁ・・・。これバージョンアップとかで変わったりするとドヨーンとした気分になるぞ orz


2008/06/17 16:34:51200816:34

mod_rewriteを使うにはFollowSymLinksが必要

mod_rewriteを使うにはFollowSymLinksが必要タイトル通りだけど、つい昨日にハマったのでメモ。

URLの書き換えとかに利用するApacheの拡張であるmod_rewriteですが、Apacheの設定で「FollowSymLinks」設定がオフになっていると使えないようです。ただしmod_rewriteの設定を.htaccessから呼ぶ場合ね(ここ重要)。ちなみに、mod_rewriteマニュアルは下記。

と、上のリンクのマニュアルを読み進めていくと以下のような文章が・・・。

The rewrite engine may be used in .htaccess files. To enable the rewrite engine for these files you need to set “RewriteEngine On” and “Options FollowSymLinks” must be enabled. If your administrator has disabled override of FollowSymLinks for a user’s directory, then you cannot use the rewrite engine. This restriction is required for security reasons.

あら、マニュアルにも書いてあるわいな。あっちゃー。ま、ざっくり言うと「Options -FollowSymLinks」ではダメで「Options FollowSymLinks」とかにしないとダメって事です。

私信になっちゃいますが、サーバーの対応してもらったMさん。本当にスイマセンm(_ _)m

昔のエントリー


2008/05/22 12:13:27200812:13

lighttpdのlogrotate設定

lighttpdのlogrotate設定elanbeat’s wiki経由。lighttpdを入れてログをlogrotateしてたんですが、ちゃんと再起動してくれないみたいで、困ったなと思ってた時に見つけた物。

ま、要するにpidを保存してあるファイルを指定してあげた方が良いでっせ。という事らしい。

/path/to/lighttpd/*log {
    missingok
    notifempty
    sharedscripts
    postrotate
        /bin/kill -HUP `cat /path/to/lighttpd.pid 2>/dev/null` 2> /dev/null || true
    endscript
}

上のようにlogrotate.dの中に置いてある設定ファイルを書く感じ。もちろんpidのファイルの場所と、ログの場所は変更する必要アリ。


2007/12/06 18:45:16200718:45
Page 1 of 41234
ネズミ「ここからメニューだすよ」
ネズミ「ごちそういっぱーい」
ネズミ「腹へったー」
ネズミ「働けー働けー♪」