Tips記事
» 2002年10月23日 21時47分 UPDATE

コンパクトなhttpデーモン「tux」が使いたい

[木田佳克,ITmedia]

 Linuxカーネル2.4から搭載されたhttpd「tux」。Apacheと比べメモリ使用量が少なく、比較的マシンパワーを消費しないという特徴がある。すでにインストール済みかどうかは、次のようにして確認すればよい。

# rpm -qa|grep tux-
tux-2.2.7-3

 多機能さを求めないのであれば、Apacheの代わりとしてtuxを検討してみてもよいだろう。設定は簡単だ。すでにApacheが動作しているのであれば、取りあえず次のようにtuxの設定ファイルから「DOCROOT=」、「DAEMON_UID=」、「DAEMON_GID=」を確認しよう。これだけで稼働できる。

# vi /etc/sysconfig/tux

# /etc/sysconfig/tux

# TUXTHREADS sets the number of kernel threads (and associated daemon
# threads) that will be used. $TUXTHREADS defaults to the number of
# CPUs on the system.
# TUXTHREADS=1

# DOCROOT is the document root; it works the same way as other web
# servers such as apache. /var/www/html/ is the default.
DOCROOT=/var/www/html/

# DAEMON_UID and DAEMON_GID are the user and group as which the daemon runs
# They default to "nobody"
# This does not mean that you should execute untrusted modules -- they
# are opened as user/group root, which means that the _init() function,
# if it exists, is run as root. This feature is only designed to help
# protect from programming mistakes; it is NOT really a security mechanism.
DAEMON_UID=nobody
DAEMON_GID=nobody

# CGIs can be started in a chroot environment by default.
# Defaults to $DOCROOT; set CGIROOT=/ if you want CGI programs
# to have access to the whole system.
# CGIROOT=/var/www/html

# each HTTP connection has an individual timer that makes sure
# no connection hangs forever. (due to browser bugs or DoS attacks.)
# MAX_KEEPALIVE_TIMEOUT=30

# TUXMODULES is a list of user-space TUX modules. User-space TUX
# modules are used to serve dynamically-generated data via tux.
# "man 2 tux" for more information
# TUXMODULES="demo.tux demo2.tux demo3.tux demo4.tux"

# MODULEPATH is the path to user-space TUXapi modules
# MODULEPATH="/"

 起動させるには、RPMパッケージの場合制御スクリプトが用意されているため次のように指定すればよい。

# /etc/rc.d/init.d/tux start

Copyright © ITmedia, Inc. All Rights Reserved.

注目のテーマ