Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > media > contrib-release > by-pkgid > 0a79c2f4a8b4059ce301ebce6e191af3 > files > 7

apache-mod_ipenv-1.0.2-6mdv2008.1.x86_64.rpm

これはなに?
------------
ipenv はクライアントのIPアドレス、ホスト名をもとに環境変数を
設定するApache2モジュールです。

以下のような用途で便利です。
 -mod_access(Apache2.2以降だとmod_authz_host)と組み合わせた
  IPアドレス/ホスト名ベースのアクセス制御
 -mod_rewriteと組み合わせたIPアドレス/ホスト名ベースのリライト処理


コンパイルとインストール
------------------------
apxsでコンパイルとインストールを行ってください(一部環境ではapxs2)。

  # apxs -c -i mod_ipenv.c

または

 $ apxs -c mod_ipenv.c
 # apxs -i mod_ipenv.c


使い方
------
テキスト形式でIPアドレス/ホスト名の一覧を記述してください。

  # cat access/localhost.conf
  127.0.0.1
  192.168.0.0/24
  .localdomain
  localhost.example.com

httpd.confでモジュールを読み込みます。

  LoadModule ipenv_module  mod_ipenv.so

環境変数を制御したい場所でSetEnvIpディレクティブを使用します。

  <Directory "/var/www/html/local">
    SetEnvIp access/localhost.conf LOCAL
    Order deny,allow
    deny from all
    allow from LOCAL
  </Diretory>



ディレクティブ
--------------
SetEnvIp ディレクティブ
  説明:         IPアドレス、ホスト名に基づいて環境変数を設定します。
  構文:         SetEnvIp file [!]envname
  コンテキスト: サーバ設定ファイル, バーチャルホスト, ディレクトリ
                , .htaccess
  上書き:       FileInfo 
  
  クライアントのIPアドレス/ホスト名が、fileに記述されているIPアドレス
  /ホスト名と一致する場合に環境変数を定義します(!が記述されている場合は
  削除します)。
  ホスト名の一致には二重引きを行います。
  
  ファイル内には以下のものが記述できます。
  ・コメント
    行頭に#がついている場合、コメントとみなして読み飛ばします。
    例)
      #コメント
  
  ・IPアドレス
    完全なIPアドレス、IPアドレスの先頭部、ネットマスク指定、
    ビット数でのネットマスク指定が使用できます。
    例)
      192.168.0.1
      192.168.0.
      192.168.0.0/255.255.255.0
      192.168.0.0/24
  
  ・ホスト名(完全修飾ドメイン)
    例)
      host.example.com
  
  ・ドメイン名
    例)
      .example.com


メモ
----
サーバールート(httpd.conf直下、VirtualHost直下=Directory, Locationの外)では
mod_setenvifとは一緒に使えません。
mod_setenvifはサーバールートでは異なるフェーズ(post_read_request)で
呼ばれるためです。これは将来のリリースで対応する予定は*ありません*。

今後
----
・各種環境での動作テスト
・ファイルの更新日時の監視と、更新時にキャッシュを読み込みなおす機能
  (RewriteMapのような振る舞い)


バグ
----
バグらしきものが見つかったら 池田泰之<yasuke@users.sourceforge.net> までご一報ください。


著作権
------
著作権は池田泰之に帰属します。
GPLのもとでの再配布を認めます。

Copyright 2006 Ikeda Yasuyuki

ipenv is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
any later version.

ipenv is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with ipenv; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA