Apache2.2 DSOの使い方

前提として、あらかじめApacheでDSOを有効化してインストールしておく。
DSOを有効化するには、–enable-soを指定する。

./configure
--prefix=/usr/local/httpd-2.2.14
--enable-dav
--enable-dav-fs
--enable-so
--enable-module=status

上記のconfigureではdav、dav-fsモジュールをstaticでインストールしている。
インストール後に、staticでモジュールを追加するには/usr/local/httpd-2.2.14を削除してクリーンインストールし直す必要があるっぽい。
make installしただけでは上書きされなかった。
で、例として後からDSOでmod_proxyを追加するには

./configure
--prefix=/usr/local/httpd-2.2.14
--enable-dav
--enable-dav-fs
--enable-so
--enable-proxy=shared
--enable-module=status

として、sharedにすれば、DSOとして組み込める。
ちなみに–enable-proxyだけだとstatic扱いになる。
この状態でmake installすると、/usr/local/httpd-2.2.14/modulesに、mod_proxy.soなどが追加される。
httpd.confは書き変えられないので、既存の設定には影響を及ぼさない。
インストール後、httpd.confを開き、

#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule proxy_module        modules/mod_proxy.so  # 追加

として、LoadModuleで読み込むようにして、httpdを再起動する。
その後、

$ sudo /usr/local/httpd-2.2.14/bin/httpd -M
Loaded Modules:
 core_module (static)
 authn_file_module (static)
 authn_default_module (static)
 authz_host_module (static)
 authz_groupfile_module (static)
 authz_user_module (static)
 authz_default_module (static)
 auth_basic_module (static)
 include_module (static)
 filter_module (static)
 log_config_module (static)
 env_module (static)
 setenvif_module (static)
 version_module (static)
 mpm_prefork_module (static)
 http_module (static)
 mime_module (static)
 dav_module (static)
 status_module (static)
 autoindex_module (static)
 asis_module (static)
 cgi_module (static)
 dav_fs_module (static)
 negotiation_module (static)
 dir_module (static)
 actions_module (static)
 userdir_module (static)
 alias_module (static)
 so_module (static)
 proxy_module (shared)

とすれば、proxy_moduleがshared(==DSO)で有効化されていることが確認できる。

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です