<-
Apache > HTTP サーバ > ドキュメンテーション > バージョン 2.2 > モジュール

Please note

This document refers to the 2.2 version of Apache httpd, which is no longer maintained. The active release is documented here. If you have not already upgraded, please follow this link for more information.

You may follow this link to go to the current version of this document.

Apache モジュール mod_userdir

翻訳済み言語:  en  |  ja  |  ko  |  tr 

この日本語訳はすでに古くなっている 可能性があります。 最近更新された内容を見るには英語版をご覧下さい。
説明:ユーザ専用のディレクトリを提供
ステータス:Base
モジュール識別子:userdir_module
ソースファイル:mod_userdir.c

概要

このモジュールは、 http://example.com/~user/ 構文を使ってユーザ専用ディレクトリにアクセスできるようにします。

ディレクティブ

参照

top

UserDir ディレクティブ

説明:ユーザ専用ディレクトリの位置
構文:UserDir directory-filename
コンテキスト:サーバ設定ファイル, バーチャルホスト
ステータス:Base
モジュール:mod_userdir

UserDir ディレクティブは、 ユーザのドキュメントへのリクエストを受けた時に使う ユーザのホームディレクトリ中の、実際のディレクトリを 設定します。 directory-filename には次のどれかを指定します:

もし enableddisabled キーワードも UserDir に現われていなければ、 引数はファイル名パターンとして扱われ、 名前からディレクトリへの変換の指定を行なう時に使われます。 http://www.foo.com/~bob/one/two.html へのリクエストは次のように変換されます:

UserDir ディレクティブ 変換後のパス
UserDir public_html~bob/public_html/one/two.html
UserDir /usr/web/usr/web/bob/one/two.html
UserDir /home/*/www/home/bob/www/one/two.html

次のディレクティブはクライアントに対してリダイレクトを 送信します:

UserDir ディレクティブ 変換後のパス
UserDir http://www.foo.com/usershttp://www.foo.com/users/bob/one/two.html
UserDir http://www.foo.com/*/usrhttp://www.foo.com/bob/usr/one/two.html
UserDir http://www.foo.com/~*/http://www.foo.com/~bob/one/two.html
このディレクティブを使うときは注意してください; "UserDir ./" は "/~root" から "/" へマップしますが、 これは望ましい動作ではないでしょう。 "UserDir disabled root" 宣言を 設定の中に含めておくことを強くお薦めします。 追加情報に Directory ディレクティブや セキュリティ Tips のページもご覧下さい。

追加の例:

少数のユーザのみが UserDir ディレクトリを利用し、それ以外には利用させたくない場合は 次を使いましょう:

UserDir disabled
UserDir enabled user1 user2 user3

大部分のユーザは UserDir ディレクトリを利用するけれど、 少数の人は不許可にしたい場合は、次を使いましょう:

UserDir enabled
UserDir disabled user4 user5 user6

他のユーザディレクトリを指定することもできます。 次のようなコマンドを使うと:

Userdir public_html /usr/web http://www.foo.com/

http://www.foo.com/~bob/one/two.html へのリクエストはまず ~bob/public_html/one/two.html のページを調べ、その次に /usr/web/bob/one/two.html を調べ、最後に http://www.foo.com/bob/one/two.html へのリダイレクトを送ります。

リダイレクトを加える場合は、リストの最後の選択肢でなければなりません。 Apache はリダイレクトが成功するかどうかを決めることはできませんので、 リストの前の方にリダイレクトを書くと、それが必ず使用される選択肢に なってしまいます。

2.1.4 以降では、ユーザディレクトリ置換機能はデフォルトでは起動しません。 それ以前のバージョンでは、UserDir ディレクティブが存在しなければ、UserDir public_html であると仮定されていました。

参照

翻訳済み言語:  en  |  ja  |  ko  |  tr 

top

コメント

Notice:
This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Libera.chat, or sent to our mailing lists.