blob: 1c5d7d20053183102a98c05258b5273db7f88b61 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.ja.xsl"?>
<!-- English Revision: 1591193:1745806 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<manualpage metafile="public_html.xml.meta">
<parentdocument href="./">How-To / チュートリアル</parentdocument>
<title>ユーザ毎のウェブディレクトリ</title>
<summary>
<p>複数のユーザのいるシステムでは、<directive
module="mod_userdir">UserDir</directive> ディレクティブを使って
各ユーザがホームディレクトリにウェブサイトを構築できるように設定することが
可能です。URL <code>http://example.com/~username/</code> を訪れた人は
"<code>username</code>" というユーザの <directive
module="mod_userdir">UserDir</directive> ディレクティブで指定された
サブディレクトリからコンテンツを得ることになります。</p>
<p>in the default config file, and adapting the <code
>httpd-userdir.conf</code>
file as necessary, or by including the appropriate directives in a
<code>Directory</code> block within the main config file.</p>
<p>デフォルトではこれらのディレクトリへのアクセスは<strong>許可されていません</strong>
<directive module="mod_userdir">UserDir</directive> を使って有効にできます。
有効にするには、デフォルトの設定ファイルで付随する
<code>httpd-userdir.conf</code> ファイルが必要で、
その中の次の行のコメントアウトを外して有効にするか、
</p>
<example>
#Include conf/extra/httpd-userdir.conf
</example>
<p>あるいは、メインの設定ファイル中の <code>Directory</code>
ブロックの中に適切にディレクティブを記述しておきます。</p>
</summary>
<seealso><a href="../urlmapping.html">URL からファイルシステムへのマッピング</a></seealso>
<section id="related">
<title>ユーザ毎のウェブディレクトリ</title>
<related>
<modulelist>
<module>mod_userdir</module>
</modulelist>
<directivelist>
<directive module="mod_userdir">UserDir</directive>
<directive module="core">DirectoryMatch</directive>
<directive module="core">AllowOverride</directive>
</directivelist>
</related>
</section>
<section id="userdir">
<title>UserDir を使ってファイルのパスを設定する</title>
<p><directive module="mod_userdir">UserDir</directive> ディレクティブは
ユーザ毎のコンテンツが読み込まれるディレクトリを指定します。
このディレクティブはいろいろ違った形式を取ることができます。</p>
<p>スラッシュで始まらないパスが与えられたときは、ユーザのホームディレクトリ
からの相対パスとみなされます。次の設定があったときに:</p>
<highlight language="config">UserDir public_html</highlight>
<p>URL <code>http://example.com/~rbowen/file.html</code>
パス <code>/home/rbowen/public_html/file.html</code>
変換されます。</p>
<p>パスがスラッシュで始まるときは、ディレクトリパスはそのパスに
ユーザ名を加えたものからなります。次の設定のとき:</p>
<highlight language="config">UserDir /var/html</highlight>
<p>URL <code>http://example.com/~rbowen/file.html</code>
パス <code>/var/html/rbowen/file.html</code> へ変換されます。</p>
<p>アスタリスク (*) を含むパスが指定されたときは、アスタリスクを
ユーザ名で置換したものが使用されます。このような設定だと:</p>
<highlight language="config">UserDir /var/www/*/docs</highlight>
<p>URL <code>http://example.com/~rbowen/file.html</code>
パス <code>/var/www/rbowen/docs/file.html</code> へ変換されます。</p>
<p>ディレクトリやディレクトリパスを複数設定することもできます。</p>
<highlight language="config">UserDir public_html /var/html</highlight>
<p><code>http://example.com/~rbowen/file.html</code> という
URL に対しては <code>~rbowen</code> を探します。見つからなければ、
<code>/var/html</code> の下にある <code>rbowen</code> を探します。
もし見つかれば上記の URL は <code>/var/html/rbowen/file.html</code>
というファイルパスに変換されます。</p>
</section>
<section id="redirect">
<title>外部 URL にリダイレクトする</title>
<p><directive module="mod_userdir">UserDir</directive>
ディレクティブを使って外部 URL にリダイレクトすることもできます。</p>
<highlight language="config">UserDir http://example.org/users/*/</highlight>
<p>上記例では <code>http://example.com/~bob/abc.html</code>
へのリクエストは <code>http://example.org/users/bob/abc.html</code>
にリダイレクトされます。</p>
</section>
<section id="enable">
<title>この機能を使用できるユーザを制限する</title>
<p>UserDir のドキュメントに示されている構文を使うことで、
どのユーザがこの機能を使うことができるかを制限することができます:</p>
<example>
UserDir enabled<br />
UserDir disabled root jro fish
</example>
<p>上の設定は <code>dissabled</code> 文のユーザ以外のすべてのユーザに
対して UserDir の機能を有効にします。同様にして、以下のように
数名のユーザ以外に対してこの機能を無効にすることもできます:</p>
<highlight language="config">
UserDir disabled<br />
UserDir enabled rbowen krietz
</highlight>
<p>他の例は <directive module="mod_userdir">UserDir</directive>
の説明を参照してください。</p>
</section>
<section id="cgi">
<title>ユーザ毎の CGI ディレクトリ</title>
<p>それぞれのユーザに専用の cgi-bin ディレクトリを与えるために、
<directive module="core" type="section">Directory</directive>
を使ってユーザのホームディレクトリの指定された領域に対して CGI を有効に
することができます。</p>
<highlight language="config">
&lt;Directory /home/*/public_html/cgi-bin/&gt;
Options ExecCGI
SetHandler cgi-script
&lt;/Directory&gt;
</highlight>
<p>そして、<code>UserDir</code>
<code>public_html</code> に設定されていると仮定すると、
そのディレクトリの CGI プログラム <code>example.cgi</code>
は以下の様に呼び出されることができます:</p>
<example>
http://example.com/~rbowen/cgi-bin/example.cgi
</example>
</section>
<section id="htaccess">
<title>ユーザによる設定変更を許可</title>
<p>ユーザに彼らのウェブ空間でのサーバの設定の変更を許可する場合、
ユーザは <code>.htaccess</code> ファイルを使って設定を変更する必要があります。
<directive module="core">AllowOverride</directive> の値を
ユーザが変更することを許可したいディレクティブに対して十分なものに
設定していることを確認してください。この機能がどのようにして動作しているか
の詳細は <a href="htaccess.html">.htaccess チュートリアル</a> を読んで
ください。</p>
</section>
</manualpage>