1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.ja.xsl"?>
4 <!-- English Revision: 1591191:1741842 (outdated) -->
7 Licensed to the Apache Software Foundation (ASF) under one or more
8 contributor license agreements. See the NOTICE file distributed with
9 this work for additional information regarding copyright ownership.
10 The ASF licenses this file to You under the Apache License, Version 2.0
11 (the "License"); you may not use this file except in compliance with
12 the License. You may obtain a copy of the License at
14 http://www.apache.org/licenses/LICENSE-2.0
16 Unless required by applicable law or agreed to in writing, software
17 distributed under the License is distributed on an "AS IS" BASIS,
18 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 See the License for the specific language governing permissions and
20 limitations under the License.
23 <manualpage metafile="public_html.xml.meta">
24 <parentdocument href="./">How-To / チュートリアル</parentdocument>
26 <title>ユーザ毎のウェブディレクトリ</title>
29 <p>複数のユーザのいるシステムでは、<directive
30 module="mod_userdir">UserDir</directive> ディレクティブを使って
31 各ユーザがホームディレクトリにウェブサイトを構築できるように設定することが
32 可能です。URL <code>http://example.com/~username/</code> を訪れた人は
33 "<code>username</code>" というユーザの <directive
34 module="mod_userdir">UserDir</directive> ディレクティブで指定された
35 サブディレクトリからコンテンツを得ることになります。</p>
37 <p>in the default config file, and adapting the <code
38 >httpd-userdir.conf</code>
39 file as necessary, or by including the appropriate directives in a
40 <code>Directory</code> block within the main config file.</p>
41 <p>デフォルトではこれらのディレクトリへのアクセスは<strong>許可されていません</strong>。
42 <directive module="mod_userdir">UserDir</directive> を使って有効にできます。
43 有効にするには、デフォルトの設定ファイルで付随する
44 <code>httpd-userdir.conf</code> ファイルが必要で、
45 その中の次の行のコメントアウトを外して有効にするか、
48 #Include conf/extra/httpd-userdir.conf
50 <p>あるいは、メインの設定ファイル中の <code>Directory</code>
51 ブロックの中に適切にディレクティブを記述しておきます。</p>
54 <seealso><a href="../urlmapping.html">URL からファイルシステムへのマッピング</a></seealso>
56 <section id="related">
57 <title>ユーザ毎のウェブディレクトリ</title>
60 <module>mod_userdir</module>
63 <directive module="mod_userdir">UserDir</directive>
64 <directive module="core">DirectoryMatch</directive>
65 <directive module="core">AllowOverride</directive>
70 <section id="userdir">
71 <title>UserDir を使ってファイルのパスを設定する</title>
73 <p><directive module="mod_userdir">UserDir</directive> ディレクティブは
74 ユーザ毎のコンテンツが読み込まれるディレクトリを指定します。
75 このディレクティブはいろいろ違った形式を取ることができます。</p>
77 <p>スラッシュで始まらないパスが与えられたときは、ユーザのホームディレクトリ
78 からの相対パスとみなされます。次の設定があったときに:</p>
80 <highlight language="config">UserDir public_html</highlight>
82 <p>URL <code>http://example.com/~rbowen/file.html</code> は
83 パス <code>/home/rbowen/public_html/file.html</code> へ
86 <p>パスがスラッシュで始まるときは、ディレクトリパスはそのパスに
87 ユーザ名を加えたものからなります。次の設定のとき:</p>
89 <highlight language="config">UserDir /var/html</highlight>
91 <p>URL <code>http://example.com/~rbowen/file.html</code> は
92 パス <code>/var/html/rbowen/file.html</code> へ変換されます。</p>
94 <p>アスタリスク (*) を含むパスが指定されたときは、アスタリスクを
95 ユーザ名で置換したものが使用されます。このような設定だと:</p>
97 <highlight language="config">UserDir /var/www/*/docs</highlight>
99 <p>URL <code>http://example.com/~rbowen/file.html</code> は
100 パス <code>/var/www/rbowen/docs/file.html</code> へ変換されます。</p>
102 <p>ディレクトリやディレクトリパスを複数設定することもできます。</p>
104 <highlight language="config">UserDir public_html /var/html</highlight>
107 <p><code>http://example.com/~rbowen/file.html</code> という
108 URL に対しては <code>~rbowen</code> を探します。見つからなければ、
109 <code>/var/html</code> の下にある <code>rbowen</code> を探します。
110 もし見つかれば上記の URL は <code>/var/html/rbowen/file.html</code>
111 というファイルパスに変換されます。</p>
115 <section id="redirect">
116 <title>外部 URL にリダイレクトする</title>
117 <p><directive module="mod_userdir">UserDir</directive>
118 ディレクティブを使って外部 URL にリダイレクトすることもできます。</p>
120 <highlight language="config">UserDir http://example.org/users/*/</highlight>
123 <p>上記例では <code>http://example.com/~bob/abc.html</code>
124 へのリクエストは <code>http://example.org/users/bob/abc.html</code>
128 <section id="enable">
129 <title>この機能を使用できるユーザを制限する</title>
131 <p>UserDir のドキュメントに示されている構文を使うことで、
132 どのユーザがこの機能を使うことができるかを制限することができます:</p>
135 UserDir enabled<br />
136 UserDir disabled root jro fish
139 <p>上の設定は <code>dissabled</code> 文のユーザ以外のすべてのユーザに
140 対して UserDir の機能を有効にします。同様にして、以下のように
141 数名のユーザ以外に対してこの機能を無効にすることもできます:</p>
143 <highlight language="config">
144 UserDir disabled<br />
145 UserDir enabled rbowen krietz
148 <p>他の例は <directive module="mod_userdir">UserDir</directive>
154 <title>ユーザ毎の CGI ディレクトリ</title>
156 <p>それぞれのユーザに専用の cgi-bin ディレクトリを与えるために、
157 <directive module="core" type="section">Directory</directive>
158 を使ってユーザのホームディレクトリの指定された領域に対して CGI を有効に
161 <highlight language="config">
162 <Directory /home/*/public_html/cgi-bin/>
164 SetHandler cgi-script
168 <p>そして、<code>UserDir</code> が
169 <code>public_html</code> に設定されていると仮定すると、
170 そのディレクトリの CGI プログラム <code>example.cgi</code>
171 は以下の様に呼び出されることができます:</p>
174 http://example.com/~rbowen/cgi-bin/example.cgi
179 <section id="htaccess">
180 <title>ユーザによる設定変更を許可</title>
182 <p>ユーザに彼らのウェブ空間でのサーバの設定の変更を許可する場合、
183 ユーザは <code>.htaccess</code> ファイルを使って設定を変更する必要があります。
184 <directive module="core">AllowOverride</directive> の値を
185 ユーザが変更することを許可したいディレクティブに対して十分なものに
186 設定していることを確認してください。この機能がどのようにして動作しているか
187 の詳細は <a href="htaccess.html">.htaccess チュートリアル</a> を読んで