Changes between Version 1 and Version 2 of TracCgi


Ignore:
Timestamp:
Jun 21, 2008, 6:11:58 PM (16 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TracCgi

    v1 v2  
    1 = CGI として Trac をインストールする =
     1= Installing Trac as CGI =
    22
    3 Trac を CGI スクリプトとしてインストールするために、 Web サーバが `trac.cgi` を CGI として実行できるようにする必要があります。
     3To install Trac as a CGI script, you need to make the `trac.cgi` executable as a CGI by your web server.
    44
    5   ''Trac を CGI 経由で使用するのは、他のメソッド [TracModPython mod_python] や [TracFastCgi FastCGI] よりも極めて遅いということに注意して下さい。''
     5  ''Please note that using Trac via CGI is significantly slower than any other deployment method, such as [TracModPython mod_python] or [TracFastCgi FastCGI].''
    66
    7 [http://httpd.apache.org/ Apache HTTPD] を使用している場合、設定方法は 2 通りあります:
     7If you're using [http://httpd.apache.org/ Apache HTTPD], there are a couple ways to do that:
    88
    9  1. `ScriptAlias` を使用し、 `trac.cgi` スクリプトを URL にマップする。
    10  2. CGI プログラムが実行可能な、Web サーバ上のディレクトリ (通常は `cgi-bin` が使用される) に `trac.cgi` ファイルをコピーする。シンボリックリンクでも代用できますが、その場合 `cgi-bin` ディレクトリでは `FollowSymLinks` オプションを有効にして下さい。
     9 1. Use a `ScriptAlias` to map a URL to the `trac.cgi` script
     10 2. Copy the `trac.cgi` file into the directory for CGI executables used by your web server (commonly named `cgi-bin`). You can also create a symbolic link, but in that case make sure that the `FollowSymLinks` option is enabled for the `cgi-bin` directory.
    1111
    12 CGI を分かりやすい URL にマッピングできるので、 1 番目のオプションを推奨します。
     12The first option is recommended as it also allows you to map the CGI to a friendly URL.
    1313
    14 それでは、 Apache の設定ファイルに以下のブロックを追記し、ファイル名とロケーションを変更してください:
     14Now, edit the Apache configuration file and add this snippet, file names and locations changed to match your installation:
    1515{{{
    1616ScriptAlias /trac /usr/share/trac/cgi-bin/trac.cgi
    1717}}}
    1818
    19  ''このディレクティブを使用するには `mod_alias` モジュールをインストールし、有効にしておく必要があります。''
     19 ''Note that this directive requires the `mod_alias` module to be installed and enabled.''
    2020
    21 Trac のプロジェクトが 1 つの場合、 `TRAC_ENV` 環境変数を使用してプロジェクトへのパスを指定する必要があります:
     21If you're using Trac with a single project you need to set its location using the `TRAC_ENV` environment variable:
    2222{{{
    2323<Location "/trac">
     
    2626}}}
    2727
    28 もしくは、複数のプロジェクトを扱うために、それらの親ディレクトリを `TRAC_ENV_PARENT_DIR` を使用して設定することができます。
     28Or to use multiple projects you can specify their common parent directory using the `TRAC_ENV_PARENT_DIR` variable:
    2929{{{
    3030<Location "/trac">
     
    3333}}}
    3434
    35  ''`SetEnv` ディレクティブを使用するには `mod_env` モジュールをインストールし有効にしておく必要があります。''
     35 ''Note that the `SetEnv` directive requires the `mod_env` module to be installed and enable.''
    3636
    37 `http://yourhost.example.org/trac` のような URL で Trac が使用できるようになります。
     37This will make Trac available at `http://yourhost.example.org/trac`.
    3838
    39 [http://httpd.apache.org/docs/suexec.html Apache suEXEC] 機能を使用している場合、 [http://trac.edgewall.org/wiki/ApacheSuexec ApacheSuexec] を参照して下さい。
     39If you are using the [http://httpd.apache.org/docs/suexec.html Apache suEXEC] feature please see [http://trac.edgewall.org/wiki/ApacheSuexec].
    4040
    41 システムによっては、`trac.cgi` ファイルの shebang 行を編集して、実際に Python がインストールされているパスを指すように修正する必要がある ''かもしれません''。 Windows システム上では、 Windowsが .cgi ファイルを実行できるように設定する必要があるでしょう。 (エクスプローラ -> ツール -> フォルダオプション -> ファイルの種類 -> CGI を Python と関連付ける)
     41On some systems, you ''may'' need to edit the shebang line in the `trac.cgi` file to point to your real Python installation path. On a Windows system you may need to configure Windows to know how to execute a .cgi file (Explorer -> Tools -> Folder Options -> File Types -> CGI).
    4242
    43 == 静的なリソースをマッピングする ==
     43== Mapping Static Resources ==
    4444
    45 このままでも Trac はスタイルシートや画像ファイルなどの静的なリソースを扱えますが、 CGI のセットアップとしては妥当な設定とは言えません。 Web サーバ自身がはるかに効率良くに直接扱うことができるドキュメントまで、 CGI スクリプトとして呼び出してしまうという結果になるからです。
     45Out of the box, Trac will serve static resources such as style sheets or images itself. For a CGI setup, though, this is highly undesirable, because it results in the CGI script being invoked for documents that could be much more efficiently served by the web server directly.
    4646
    47 [http://httpd.apache.org/ Apache HTTPD] のような Web サーバはリソースに対して "Alias" を設定することで仮想の URL を与え、サーバのファイルシステムのレイアウトとは異なる位置にマップすることができます。すでに CGI スクリプトに対して `ScriptAlias` を定義していますので、ファイルシステム上の静的リソースを含んだコンテンツをマッピングすることで CGI スクリプトの要求を回避します。
     47Web servers such as [http://httpd.apache.org/ Apache HTTPD] allow you to create “Aliases” to resources, thereby giving them a virtual URL that doesn't necessarily bear any resemblance to the layout of the servers file system. We already used this capability above when defining a `ScriptAlias` for the CGI script, and we'll use it now to map requests to the static resources to the directory on the file system that contains them, thereby bypassing the processing of such requests by the CGI script.
    4848
    49 Apacheの設定ファイルを再び編集して、 CGI スクリプトの `ScriptAlias` を追記したブロックより '''上に''' 以下のブロックを追記します。ファイル名とロケーションは適宜変更してください:
     49Edit the Apache configuration file again and add the following snippet '''before''' the `ScriptAlias` for the CGI script , file names and locations changed to match your installation:
    5050{{{
    5151Alias /trac/chrome/common /usr/share/trac/htdocs
     
    5656}}}
    5757
    58 `trac.cgi` スクリプトにどんな URL をマッピングしたとしても、 `/chrome/common` というパスでは静的リソースのロケーションを使用するようになります。
     58Note that whatever URL path you mapped the `trac.cgi` script to, the path `/chrome/common` is the path you have to append to that location to intercept requests to the static resources.
    5959
    60 例えば、Trac が `/cgi-bin/trac.cgi`にマッピングされているとしたら、AliasのURLは `cgi-bin/trac.cgi/chrome/common` となります。
     60For example, if Trac is mapped to `/cgi-bin/trac.cgi` on your server, the URL of the Alias should be `/cgi-bin/trac.cgi/chrome/common`.
    6161
    62 代わりに、[wiki:TracIni trac.ini] のオプションで `htdocs_location` を設定することができます:
     62Alternatively, you can set the `htdocs_location` configuration option in [wiki:TracIni trac.ini]:
    6363{{{
    6464[trac]
     
    6666}}}
    6767
    68 Trac は HTML ページに静的リソースを組み込むときに、この URL を使用するようになります。もちろん、それでも、特定の URL が指定されたときに 例えば、 Web サーバーのドキュメントルートにディレクトリをコピーするなり、シンボリックリンクを張るなりして、Web サーバ経由で、 Trac が `htdocs` ディレクトリを利用できるようにしておく必要があります:
     68Trac will then use this URL when embedding static resources into HTML pages. Of course, you still need to make the Trac `htdocs` directory available through the web server at the specified URL, for example by copying (or linking) the directory into the document root of the web server:
    6969{{{
    7070$ ln -s /usr/share/trac/htdocs /var/www/your_site.com/htdocs/trac-htdocs
    7171}}}
    7272
    73 == 認証を追加する ==
     73== Adding Authentication ==
    7474
    75 Apache で認証を追加する最も単純な方法はパスワードファイルを作ることです。 `htpasswd` プログラムを使用してパスワードファイルを作成します:
     75The simplest way to enable authentication with Apache is to create a password file. Use the `htpasswd` program to create the password file:
    7676{{{
    7777$ htpasswd -c /somewhere/trac.htpasswd admin
     
    8181}}}
    8282
    83 一番最初のユーザ以外は "-c" オプションは必要ありません:
     83After the first user, you dont need the "-c" option anymore:
    8484{{{
    8585$ htpasswd /somewhere/trac.htpasswd john
     
    8989}}}
    9090
    91   ''`htpasswd` についての詳細は man を見てください。''
     91  ''See the man page for `htpasswd` for full documentation.''
    9292
    93 ユーザを作成した後、 TracPermissions の記述通りユーザに権限を設定することができます。
     93After you've created the users, you can set their permissions using TracPermissions.
    9494
    95 Apache の設定ファイルの中にパスワードファイル名を記述し、認証を有効にする必要があります:
     95Now, you'll need to enable authentication against the password file in the Apache configuration:
    9696{{{
    9797<Location "/trac/login">
     
    103103}}}
    104104
    105 複数のプロジェクトを持っている場合でも、パスワードファイルはプロジェクトで共通なものを使用することができます:
     105If you're hosting multiple projects you can use the same password file for all of them:
    106106{{{
    107107<LocationMatch "/trac/[^/]+/login">
     
    113113}}}
    114114
    115 より堅固なセキュリティのために、 SSL を有効にするか、少なくとも "基本認証" の代わりに "ダイジェスト認証" を使用することを推奨します。より詳しい情報については [http://httpd.apache.org/docs/2.0/ Apache HTTPD documentation] を参照して下さい。
     115For better security, it is recommended that you either enable SSL or at least use the “Digest” authentication scheme instead of “Basic”. Please read the [http://httpd.apache.org/docs/2.0/ Apache HTTPD documentation] to find out more.
    116116
    117117----