ni kvel

漠然的な Something を Do しちゃうところ。

Archive for the ‘lighttpd’ tag

lighttpd で Apache みたいな Customlog

without comments

Lighttpd をやって思ったのは、spawn-cgi から fastcgi に渡して .php .cgi を処理するようにしているので、access.log にローカルで処理した分もでてきちゃう。しかも、blog とかの log だと、.gif とか .jpg とかも入って煩わしい。

Apache の時は、下のように処理してた。

SetEnvIf Request_URI “\.(gif)|(jpg)|(png)|(css)$” nolog
LogFormat “%h %l %u %t \”%r\” %>s %b \”%{Referer}i\” \”%{User-Agent}i\”" combined
CustomLog /home/hoge/hoge.miroq.info_access.log combined env=!nolog

というようことで、実際に lighttpd でやってみた。
下のような感じでできるお。

$HTTP["remoteip"]!~”^(127\.|192\.168\.)”{
    $HTTP["url"] !~ “\.(gif)|(jpg)|(png)|(css)$” {
        accesslog.filename = “/home/hoge/hoge.miroq.info.access.log”
        }
    }

上の場合は 127.0.0.1 / 192.168.X.X と画像関連のファイルを acccesslog に吐かないようにした。
remoteip / url を逆にしてやってみたけど、だめだた。たぶん Request の評価の順番が、 remoteip > url なのだろう。考えればそのような気もするけどw

Written by miroq

4月 11th, 2008 at 9:43 am

Posted in Linux, lighttpd

Tagged with

lighttpd で wordpress を使うには

without comments

lighttpd は Apache と違い、.htaccess のような個人ごとに制御を分離させることはできない。
そのため、wordpress にて redirect を使う方法をとってしまうと、大本の conf ファイルである lighttpd.conf に記述されないと動いてくれない。

wordpress を lighttpd で使うには、以下を lighttpd.conf に追加する。

url.rewrite = (
         ”^/(wp-.+).*/?” => “$0″,
         ”^/(sitemap.xml)” => “$0″,
         ”^/(xmlrpc.php)” => “$0″,
         ”^/(.+)/?$” => “/index.php/$1″
    )

lighttpd を再起動後問題なく動くことを確認できた。
lighttpd と Apache を ab でベンチとったけど ( ab -n 10000 -c 100 http://orz.miroq.info/ )
Apache では途中 defunct になってしまうものもあった。そしてプロセスが死骸みたいにのこって 80 番ポートを占拠しやがるw

そして、現在 lighttpd で運用中。 virtual host を include で別ファイルにおけないかどうか思案中。
たぶん余裕でおけるんだけどねw

Written by miroq

3月 16th, 2008 at 9:29 am

Posted in Linux, lighttpd

Tagged with ,

ni kvel は WP Super Cache でキャッシングされているおかげで Digg に耐えられます