Changes between Version 3 and Version 4 of TracStandalone


Ignore:
Timestamp:
Dec 30, 2016, 2:54:47 AM (7 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TracStandalone

    v3 v4  
    1 ** Note: このページのドキュメントは Trac 1.0 に対応しています。それ以前のバージョンについては [[0.12/TracStandalone]] を参照してください。 **
    2 = Tracd = #Tracd
    3 
    4 Tracd は軽量なスタンドアロンの Trac web サーバです。
    5 Tracd は様々な場面で使用することができます。テストや開発用のサーバからロードバランサとして使用されているもう一つのウェブサーバの後段に複数のプロセスを配置するときなどに使われます。
    6 
    7 == 利点 == #Pros
    8 
    9  * 依存性が低い: apache その他 web サーバをインストールする必要がありません
    10  * 速い: [wiki:TracModPython mod_python] バージョンと同じくらい速いでしょう。 ([wiki:TracCgi CGI] よりはずっと速い)。そして、 バージョン 0.12 以降では、デフォルトで HTTP のバージョン 1.1 が使えるようになりました
    11  * 自動リロード: 開発のために、 Tracd は ''auto_reload'' モードを使用しています。そのため、コード ( Trac 自身またはプラグインのコード ) を更新したときに、自動的にサーバが再起動します
    12 
    13 == 欠点 == #Cons
    14 
    15  * 機能が少ない: Tracd に実装されている web サーバはとてもシンプルで、 Apache httpd のように拡張性のある設定ができません
    16  * ネイティブで HTTPS に対応しない: 代わりに [http://www.rickk.com/sslwrap/ sslwrap] または
    17    [trac:STunnelTracd stunnel -- tracd と stunnel を使うためのチュートリアル] または Apache の mod_proxy を使用します
    18 
    19 == 使用例 == #Usageexamples
    20 
    21 単一のプロジェクトをポート 8080 でホストします。 (http://localhost:8080/)
    22 {{{
     1= Tracd
     2
     3Tracd is a lightweight standalone Trac web server.
     4It can be used in a variety of situations, from a test or development server to a multiprocess setup behind another web server used as a load balancer.
     5
     6== Pros
     7
     8 * Fewer dependencies: You don't need to install apache or any other web-server.
     9 * Fast: Should be almost as fast as the [wiki:TracModPython mod_python] version (and much faster than the [wiki:TracCgi CGI]), even more so since version 0.12 where the HTTP/1.1 version of the protocol is enabled by default
     10 * Automatic reloading: For development, Tracd can be used in ''auto_reload'' mode, which will automatically restart the server whenever you make a change to the code (in Trac itself or in a plugin).
     11
     12== Cons
     13
     14 * Fewer features: Tracd implements a very simple web-server and is not as configurable or as scalable as Apache httpd.
     15 * No native HTTPS support: [http://www.rickk.com/sslwrap/ sslwrap] can be used instead,
     16   or [trac:wiki:STunnelTracd stunnel -- a tutorial on how to use stunnel with tracd] or Apache with mod_proxy.
     17
     18== Usage examples
     19
     20A single project on port 8080. (http://localhost:8080/)
     21{{{#!sh
    2322 $ tracd -p 8080 /path/to/project
    2423}}}
    25 厳密に言うと、この状態では Trac は ''localhost のみ'' ではなく、ネットワーク越しの全員からアクセス可能になっています。 ''--hostname'' オプションを使用すると接続元を制限できます。
    26 {{{
     24Strictly speaking this will make your Trac accessible to everybody from your network rather than ''localhost only''. To truly limit it use the `--hostname` option.
     25{{{#!sh
    2726 $ tracd --hostname=localhost -p 8080 /path/to/project
    2827}}}
    29 複数のプロジェクトをホストする場合はこうです (http://localhost:8080/project1/ と http://localhost:8080/project2/)
    30 {{{
     28With more than one project. (http://localhost:8080/project1/ and http://localhost:8080/project2/)
     29{{{#!sh
    3130 $ tracd -p 8080 /path/to/project1 /path/to/project2
    3231}}}
    3332
    34 Trac は異なるプロジェクト間での URL の一意性を保つために、パスの一番最後の文字列 (訳注: basename) を使用するため、プロジェクト間でパスの一番最後の部分を同じにすることは出来ません。
    35 もし、 `/project1/path/to` と `/project2/path/to` を同時に指定した場合、二つ目のプロジェクトだけしか見えなくなります。
    36 
    37 複数のプロジェクトを動かすもう一つの方法は、 `-e` オプションで親ディレクトリを指定し、サブディレクトリに TracEnvironment を配置します。上記の例は以下のように書き換えられます:
    38 {{{
     33You can't have the last portion of the path identical between the projects since Trac uses that name to keep the URLs of the
     34different projects unique. So if you use `/project1/path/to` and `/project2/path/to`, you will only see the second project.
     35
     36An alternative way to serve multiple projects is to specify a parent directory in which each subdirectory is a Trac project, using the `-e` option. The example above could be rewritten:
     37{{{#!sh
    3938 $ tracd -p 8080 -e /path/to
    4039}}}
    4140
    42 Windows でサーバを終了するには必ず {{{CTRL-BREAK}}} を使用してください。 -- {{{CTRL-C}}} を使用すると Python のプロセスがバックグラウンドで起動したままになるでしょう。
    43 
    44 == Windows サービスとしてインストールする == #InstallingasaWindowsService
    45 
    46 === オプション 1 === #Option1
    47 Windows のサービスとしてインストールするには、 [http://www.google.com/search?q=srvany.exe SRVANY] ユーティリティを入手し起動します:
    48 {{{
     41To exit the server on Windows, be sure to use `CTRL-BREAK` -- using `CTRL-C` will leave a Python process running in the background.
     42
     43== Installing as a Windows Service
     44
     45=== Option 1
     46To install as a Windows service, get the [http://www.google.com/search?q=srvany.exe SRVANY] utility and run:
     47{{{#!cmd
    4948 C:\path\to\instsrv.exe tracd C:\path\to\srvany.exe
    5049 reg add HKLM\SYSTEM\CurrentControlSet\Services\tracd\Parameters /v Application /d "\"C:\path\to\python.exe\" \"C:\path\to\python\scripts\tracd-script.py\" <your tracd parameters>"
     
    5251}}}
    5352
    54 {{{tracd.exe}}} は使用 '''しない''' で下さい。代わりに {{{python.exe}}} を直接登録し、引数に {{{tracd-script.py}}} を使用して下さい。 {{{tracd.exe}}} を使用してしまうと、 python プロセスが SRVANY の制御下ではなくなってしまうため、 {{{net stop tracd}}} を使用しても python プロセスが残留してしまいます。
    55 
    56 Windows の起動時に tracd を自動起動させることもできます:
    57 {{{
     53'''DO NOT''' use {{{tracd.exe}}}.  Instead register {{{python.exe}}} directly with {{{tracd-script.py}}} as a parameter.  If you use {{{tracd.exe}}}, it will spawn the python process without SRVANY's knowledge.  This python process will survive a {{{net stop tracd}}}.
     54
     55If you want tracd to start automatically when you boot Windows, do:
     56{{{#!cmd
    5857 sc config tracd start= auto
    5958}}}
    6059
    61 空白には意味があります。そのまま入力して下さい。
     60The spacing here is important.
    6261
    6362{{{#!div
    64 一度、Windows サービスがインストールされると、上記の `reg add` コマンドを使用するよりも、レジストリエディタを起動するほうが簡単かもしれません。指定のパスへの移動:[[BR]]
     63Once the service is installed, it might be simpler to run the Registry Editor rather than use the `reg add` command documented above.  Navigate to:[[BR]]
    6564`HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\tracd\Parameters`
    6665
    67 3 つの文字列のパラメータが提供されています:
     66Three (string) parameters are provided:
    6867||!AppDirectory ||C:\Python26\ ||
    6968||Application ||python.exe ||
    7069||!AppParameters ||scripts\tracd-script.py -p 8080 ... ||
    7170
    72 Note: もし !AppDirectory が上記のように設定されているならば、実行ファイル ''と'' スクリプトのパス、パラメータの値は、設定したフォルダへの相対パスになります。ここ一点に絞って言うと、これにより Python をアップデートするときに変更箇所が限定されるため少しだけ楽になります。
    73 (ドキュメントでは、 /full/path/to/htpasswd とフルパス指定するよう書いてあるかもしれませんが、これは、 .htpasswd ファイルについても同様のことが言えます。このファイルを Python ディレクトリ配下に配置したいと思わないかもしれません。)
    74 }}}
    75 
    76 Windows 7 ユーザは、 srvany.exe は使用できないかもしれません。代わりに [http://www.google.com/search?q=winserv.exe WINSERV] ユーティリティを使用して、起動してください:
    77 {{{
     71Note that, if the !AppDirectory is set as above, the paths of the executable ''and'' of the script name and parameter values are relative to the directory.  This makes updating Python a little simpler because the change can be limited, here, to a single point.
     72(This is true for the path to the .htpasswd file, as well, despite the documentation calling out the /full/path/to/htpasswd; however, you may not wish to store that file under the Python directory.)
     73}}}
     74
     75For Windows 7 User, srvany.exe may not be an option, so you can use [http://www.google.com/search?q=winserv.exe WINSERV] utility and run:
     76{{{#!cmd
    7877"C:\path\to\winserv.exe" install tracd -displayname "tracd" -start auto "C:\path\to\python.exe" c:\path\to\python\scripts\tracd-script.py <your tracd parameters>"
    79 
    8078net start tracd
    8179}}}
    8280
    83 === オプション 2 === #Option2
    84 
    85 [http://trac-hacks.org/ Trac Hacks] より [http://trac-hacks.org/wiki/WindowsServiceScript WindowsServiceScript] を入手して下さい。 Trac のサービスを インストール、削除、開始、停止などできます。
    86 
    87 === オプション 3 === #Option3
    88 
    89 cygwin の cygrunsrv.exe を使用することもできます:
    90 {{{
     81=== Option 2
     82
     83Use [http://trac-hacks.org/wiki/WindowsServiceScript WindowsServiceScript], available at [http://trac-hacks.org/ Trac Hacks]. Installs, removes, starts, stops, etc. your Trac service.
     84
     85=== Option 3
     86
     87also cygwin's cygrunsrv.exe can be used:
     88{{{#!sh
    9189$ cygrunsrv --install tracd --path /cygdrive/c/Python27/Scripts/tracd.exe --args '--port 8000 --env-parent-dir E:\IssueTrackers\Trac\Projects'
    9290$ net start tracd
    9391}}}
    9492
    95 == 認証を使用する == #UsingAuthentication
    96 
    97 Tracd は基本認証とダイジェスト認証の両方に対応しています。ダイジェスト認証の方がより安全です。以降の例ではダイジェスト認証を使用しています。基本認証を使用するためには、下記のコマンドライン入力時に `--auth` を `--basic-auth` に置き換えて下さい。
    98 
    99 認証を使用する際の一般的なフォーマット:
    100 {{{
     93== Using Authentication
     94
     95Tracd allows you to run Trac without the need for Apache, but you can take advantage of Apache's password tools (`htpasswd` and `htdigest`) to easily create a password file in the proper format for tracd to use in authentication. (It is also possible to create the password file without `htpasswd` or `htdigest`; see below for alternatives)
     96
     97{{{#!div style="border: 1pt dotted; margin: 1em"
     98**Attention:** Make sure you place the generated password files on a filesystem which supports sub-second timestamps, as Trac will monitor their modified time and changes happening on a filesystem with too coarse-grained timestamp resolution (like `ext2` or `ext3` on Linux, or HFS+ on OSX).
     99}}}
     100
     101Tracd provides support for both Basic and Digest authentication. Digest is considered more secure. The examples below use Digest; to use Basic authentication, replace `--auth` with `--basic-auth` in the command line.
     102
     103The general format for using authentication is:
     104{{{#!sh
    101105 $ tracd -p port --auth="base_project_dir,password_file_path,realm" project_path
    102106}}}
    103 オプションについて:
    104  * '''base_project_dir''': 下記の通りプロジェクトのベースのディレクトリを特定する:
    105    * 複数のプロジェクトを立てているとき: `project_path` への ''相対パス''
    106    * 1 つのみプロジェクトを立てているとき (`-s` オプション使用): プロジェクトのディレクトリの名前
    107  絶対パスを使用しないで下さい。 ''Note:'' このパラメータは、 Windows の環境であっても大文字小文字を区別します。
    108  * '''password_file_path''': パスワードファイルへのパス
    109  * '''realm''': realm の名前 ( なんでも指定できます )
    110  * '''project_path''': プロジェクトへのパス
    111 
    112  * **`--auth`** 上記の例では、ダイジェスト認証を使用しています。基本認証を使用する際は `--auth` を `--basic-auth` に置き換えてください。基本認証は "realm" を必要としませんが、コマンドとしては、最後の引用句に空のレルム名前が直接続くことになるので、2つ目のコンマは必要になります
    113 
    114 :
    115 
    116 {{{
     107where:
     108 * '''base_project_dir''': the base directory of the project specified as follows:
     109   * when serving multiple projects: ''relative'' to the `project_path`
     110   * when serving only a single project (`-s`): the name of the project directory
     111 Don't use an absolute path here as this won't work. ''Note:'' This parameter is case-sensitive even for environments on Windows.
     112 * '''password_file_path''': path to the password file
     113 * '''realm''': the realm name (can be anything)
     114 * '''project_path''': path of the project
     115
     116 * **`--auth`** in the above means use Digest authentication, replace `--auth` with `--basic-auth` if you want to use Basic auth.  Although Basic authentication does not require a "realm", the command parser does, so the second comma is required, followed directly by the closing quote for an empty realm name.
     117
     118Examples:
     119
     120{{{#!sh
    117121 $ tracd -p 8080 \
    118122   --auth="project1,/path/to/passwordfile,mycompany.com" /path/to/project1
    119123}}}
    120124
    121 もちろん、パスワードファイルは 1 つ以上のプロジェクトで共有することができます。
    122 {{{
     125Of course, the password file can be be shared so that it is used for more than one project:
     126{{{#!sh
    123127 $ tracd -p 8080 \
    124128   --auth="project1,/path/to/passwordfile,mycompany.com" \
     
    127131}}}
    128132
    129 パスワードファイルを共有するもう一つの方法として、プロジェクトの名前を指定するところで、 "*" を使用します:
    130 {{{
     133Another way to share the password file is to specify "*" for the project name:
     134{{{#!sh
    131135 $ tracd -p 8080 \
    132136   --auth="*,/path/to/users.htdigest,mycompany.com" \
     
    134138}}}
    135139
    136 === 基本認証: htpasswd パスワードを使用する === #BaseicAuthorizationUsingahtpasswdpasswordfile
    137 このセクションでは、 `tracd` と Apache の .htpasswd ファイルの使用方法について記述します。
    138 
    139   Note: htpasswd のフォーマットを解読するために、(少なくとも Python 2.6 は) fcrypt パッケージをインストールする必要があります。
    140   Trac のソースコードでは、まず `import crypt` を試みますが、
    141   Python 2.6 にそのようなパッケージはありません。 `SHA-1` パスワードのみ、このモジュールなしで対応します。( Trac 1.0 から)
    142 
    143 Apache の `htpasswd` コマンドを使用して、 .htpasswd ファイルを作成します。 ( Apache を使用せずにこれらのファイルを作成する方法については [#GeneratingPasswordsWithoutApache 下記] を参照して下さい):
    144 {{{
     140=== Basic Authorization: Using a htpasswd password file
     141This section describes how to use `tracd` with Apache .htpasswd files.
     142
     143  Note: On Windows It is necessary to install the [https://pypi.python.org/pypi/passlib passlib]
     144  package in order to decode some htpasswd formats. Only `SHA-1` passwords (since Trac 1.0)
     145  work without this module.
     146
     147To create a .htpasswd file use Apache's `htpasswd` command (see [#GeneratingPasswordsWithoutApache below] for a method to create these files without using Apache):
     148{{{#!sh
    145149 $ sudo htpasswd -c /path/to/env/.htpasswd username
    146150}}}
    147 そしてユーザを追加します:
    148 {{{
     151then for additional users:
     152{{{#!sh
    149153 $ sudo htpasswd /path/to/env/.htpasswd username2
    150154}}}
    151155
    152 そして、 `tracd` をこのように起動します:
    153 {{{
    154  $ tracd -p 8080 --basic-auth="projectdirname,/fullpath/environmentname/.htpasswd,realmname" /fullpath/environmentname
    155 }}}
    156 
    157 例:
    158 {{{
    159  $ tracd -p 8080 --basic-auth="testenv,/srv/tracenv/testenv/.htpasswd,My Test Env" /srv/tracenv/testenv
    160 }}}
    161 ''Note:'' いくつかのプラットフォーム (OpenBSD) では、htpasswd に "-m" をパラメータで渡す必要があるかもしれません。
    162 
    163 === ダイジェスト認証: htdigest パスワードファイルの設定方法 === #DigestauthentitionUsingahtdigestpasswordfile
    164 
    165 もし、 Apache がインストールされているなら、パスワードファイルを生成するのに、 htdigest コマンドを使用することができます。 'htdigest' とタイプして使用方法を見るか、詳細な使用方法を見るために Apache のマニュアルの [http://httpd.apache.org/docs/2.0/programs/htdigest.html このページ] を読んでください。ユーザを作成するたびに、パスワードを入力するように求められます。パスワードファイルの名前には好きな名前をつけることができますが、 `users.htdigest` というような名前にしておけば、ファイルに何が含まれているかを覚えておけるでしょう。このファイルは <projectname>/conf フォルダに [TracIni trac.ini] ファイルと一緒に置いておくとよいでしょう。
    166 
    167 引数 `--auth` なしで tracd をスタートできることに注意して下さい。ただし、 ''ログイン'' (英語版では ''Login'') リンクをクリックするとエラーになります。
    168 
    169 === Apache 以外の環境でパスワードを生成する === #GeneratingPasswordsWithoutApache
    170 
    171 基本認証は [http://aspirine.org/htpasswd_en.html online HTTP Password generator] を用いて完成させることができます。これは `SHA-1` もサポートしています。生成した password-hash をシステムの .htpasswd ファイルにコピーします。Windows 版の Python は htpasswd のデフォルトのハッシュタイプである "crypt" モジュールに対応していないので注意してください。MD5 パスワードハッシュには対応しているため、MD5 を使用するとよいでしょう。
    172 
    173 簡単な Python スクリプトで '''digest''' 認証のパスワードファイルを生成できます:
    174 
    175 {{{
    176 #!python
    177 from optparse import OptionParser
    178 # The md5 module is deprecated in Python 2.5
    179 try:
    180     from hashlib import md5
    181 except ImportError:
    182     from md5 import md5
    183 realm = 'trac'
    184 
    185 # build the options
    186 usage = "usage: %prog [options]"
    187 parser = OptionParser(usage=usage)
    188 parser.add_option("-u", "--username",action="store", dest="username", type = "string",
    189                   help="the username for whom to generate a password")
    190 parser.add_option("-p", "--password",action="store", dest="password", type = "string",
    191                   help="the password to use")
    192 parser.add_option("-r", "--realm",action="store", dest="realm", type = "string",
    193                   help="the realm in which to create the digest")
    194 (options, args) = parser.parse_args()
    195 
    196 # check options
    197 if (options.username is None) or (options.password is None):
    198    parser.error("You must supply both the username and password")
    199 if (options.realm is not None):
    200    realm = options.realm
    201 
    202 # Generate the string to enter into the htdigest file
    203 kd = lambda x: md5(':'.join(x)).hexdigest()
    204 print ':'.join((options.username, realm, kd([options.username, realm, options.password])))
    205 }}}
    206 
    207 Note: 上記のスクリプトを使用する場合、 `--auth` の引数に '''`trac`''' を指定し、レルムを設定しなければなりません。使用例 (上記スクリプトを trac-digest.py として保存したとします):
    208 
    209 {{{
    210  $ python trac-digest.py -u username -p password >> c:\digest.txt
    211  $ tracd --port 8000 --auth=proj_name,c:\digest.txt,trac c:\path\to\proj_name
    212 }}}
    213 
    214 ==== `md5sum` を使用する
    215 `md5sum` ユーティリティを使用するとダイジェスト認証のパスワードファイルを作成することができます:
    216 {{{
     156Then to start `tracd` run something like this:
     157{{{#!sh
     158 $ tracd -p 8080 --basic-auth="project,/fullpath/environmentname/.htpasswd,realmname" /path/to/project
     159}}}
     160
     161For example:
     162{{{#!sh
     163 $ tracd -p 8080 --basic-auth="project,/srv/tracenv/testenv/.htpasswd,My Test Env" /path/to/project
     164}}}
     165''Note:'' You might need to pass "-m" as a parameter to htpasswd on some platforms (OpenBSD).
     166
     167=== Digest authentication: Using a htdigest password file
     168
     169If you have Apache available, you can use the htdigest command to generate the password file. Type 'htdigest' to get some usage instructions, or read [http://httpd.apache.org/docs/2.0/programs/htdigest.html this page] from the Apache manual to get precise instructions.  You'll be prompted for a password to enter for each user that you create.  For the name of the password file, you can use whatever you like, but if you use something like `users.htdigest` it will remind you what the file contains. As a suggestion, put it in your <projectname>/conf folder along with the [TracIni trac.ini] file.
     170
     171Note that you can start tracd without the `--auth` argument, but if you click on the ''Login'' link you will get an error.
     172
     173=== Generating Passwords Without Apache
     174
     175Basic Authorization can be accomplished via this [http://aspirine.org/htpasswd_en.html online HTTP Password generator] which also supports `SHA-1`.  Copy the generated password-hash line to the .htpasswd file on your system. Note that Windows Python lacks the "crypt" module that is the default hash type for htpasswd. Windows Python can grok MD5 password hashes just fine and you should use MD5.
     176
     177Trac also provides `htpasswd` and `htdigest` scripts in `contrib`:
     178{{{#!sh
     179$ ./contrib/htpasswd.py -cb htpasswd user1 user1
     180$ ./contrib/htpasswd.py -b htpasswd user2 user2
     181}}}
     182
     183{{{#!sh
     184$ ./contrib/htdigest.py -cb htdigest trac user1 user1
     185$ ./contrib/htdigest.py -b htdigest trac user2 user2
     186}}}
     187
     188==== Using `md5sum`
     189It is possible to use `md5sum` utility to generate digest-password file:
     190{{{#!sh
    217191user=
    218192realm=
     
    222196}}}
    223197
    224 == リファレンス == #Reference
    225 
    226 これはリマインダとして、オンラインヘルプです。 (`tracd --help`):
     198== Reference
     199
     200Here's the online help, as a reminder (`tracd --help`):
    227201{{{
    228202Usage: tracd [options] [projenv] ...
     
    256230}}}
    257231
    258 tracd を起動させたターミナルウィンドウを閉じる場合には、tracd がハングアップしないように -d オプションを使用してください。
    259 
    260 == Tips == #Tips
    261 
    262 === 静的なリソースを扱う === #Servingstaticcontent
    263 
    264 もし、 `tracd` が単一のプロジェクトのみを扱う Web サーバだとしたら、
    265 静的なリソースを割り当てるのに使用することができます。
    266 (tar アーカイブ, Doxygen ドキュメントなど)
    267 
    268 この静的なリソースは `$TRAC_ENV/htdocs` フォルダに置き、
    269 `<project_URL>/chrome/site/...` という URL でアクセスします。
    270 
    271 例: ファイル名が `$TRAC_ENV/htdocs/software-0.1.tar.gz` だったとき、
    272 対応する URL は `/<project_name>/chrome/site/software-0.1.tar.gz` となります。
    273 代わりに `htdocs:software-0.1.tar.gz` (TracLinks のシンタックス) や `[/<project_name>/chrome/site/software-0.1.tar.gz]` (相対リンクのシンタックス) で記述することができます。
    274 
    275  ''TracLinks における `htdocs:` のサポートは Trac のバージョン 0.10 で追加されました。''
    276 
    277 === tracd をプロキシの背後で使用する === #Usingtracdbehindaproxy
    278 
    279 ある状況において tracd を Apache もしくは他のウェブサーバの背後で使用するときについてです。
    280 
    281 この状況において、間違ったホストやプロトコルにリダイレクトされてしまったなどの経験があるかもしれません。この場合 (そして、この場合に限って) `[trac] use_base_url_for_redirect` を `true` に設定することによって、リダイレクトを行なう際 Trac に `[trac] base_url` の値を強制的に使用させることができます。
    282 
    283 もし、`tracd` に接続するために AJP プロトコルを使用しているならば (flup をインストールしているならば可能です) 、ダブルクオテーションの問題にぶつかったことがあるかもしれません。その際は、 `--unquote` パラメータを追加することを考えてください。
    284 
    285 [trac:TracOnWindowsIisAjp], [trac:TracNginxRecipe] も参照してください。
    286 
    287 === プロキシ背後の tracd の認証 === #Authenticationfortracdbehindaproxy
    288 {{{--basic-auth}}} を使用する代わりに、tracd のインスタンスに外部認証を提供しても有効です。この方法については [trac:#9206 #9206] で議論されています。
    289 
    290 下記は Apache 2.2 、mod_proxy、mod_authnz_ldap を使用した場合の設定例です。
    291 
    292 まず Apache のネームスペースに tracd を定義します。
    293 
    294 {{{
     232Use the -d option so that tracd doesn't hang if you close the terminal window where tracd was started.
     233
     234== Tips
     235
     236=== Serving static content
     237
     238If `tracd` is the only web server used for the project,
     239it can also be used to distribute static content
     240(tarballs, Doxygen documentation, etc.)
     241
     242This static content should be put in the `$TRAC_ENV/htdocs` folder,
     243and is accessed by URLs like `<project_URL>/chrome/site/...`.
     244
     245Example: given a `$TRAC_ENV/htdocs/software-0.1.tar.gz` file,
     246the corresponding relative URL would be `/<project_name>/chrome/site/software-0.1.tar.gz`,
     247which in turn can be written as `htdocs:software-0.1.tar.gz` (TracLinks syntax) or `[/<project_name>/chrome/site/software-0.1.tar.gz]` (relative link syntax).
     248
     249=== Using tracd behind a proxy
     250
     251In some situations when you choose to use tracd behind Apache or another web server.
     252
     253In this situation, you might experience issues with redirects, like being redirected to URLs with the wrong host or protocol. In this case (and only in this case), setting the `[trac] use_base_url_for_redirect` to `true` can help, as this will force Trac to use the value of `[trac] base_url` for doing the redirects.
     254
     255If you're using the AJP protocol to connect with `tracd` (which is possible if you have flup installed), then you might experience problems with double quoting. Consider adding the `--unquote` parameter.
     256
     257See also [trac:TracOnWindowsIisAjp], [trac:TracNginxRecipe].
     258
     259=== Authentication for tracd behind a proxy
     260It is convenient to provide central external authentication to your tracd instances, instead of using `--basic-auth`. There is some discussion about this in [trac:#9206].
     261
     262Below is example configuration based on Apache 2.2, mod_proxy, mod_authnz_ldap.
     263
     264First we bring tracd into Apache's location namespace.
     265
     266{{{#!apache
    295267<Location /project/proxified>
    296268        Require ldap-group cn=somegroup, ou=Groups,dc=domain.com
     
    302274}}}
    303275
    304 HTTP_REMOTE_USER ヘッダを有効な認証ソースとして認識させるためには単一ファイルのプラグインが必要です。'''HTTP_FOO_BAR''' のような HTTP ヘッダは '''Foo-Bar''' に変換されます。'''remote-user-auth.py''' のようなファイル名をつけ、'''proxified/plugins''' ディレクトリ内に配置してください:
    305 {{{
    306 #!python
     276Then we need a single file plugin to recognize HTTP_REMOTE_USER header as valid authentication source. HTTP headers like '''HTTP_FOO_BAR''' will get converted to '''Foo-Bar''' during processing. Name it something like '''remote-user-auth.py''' and drop it into '''proxified/plugins''' directory:
     277{{{#!python
    307278from trac.core import *
    308279from trac.config import BoolOption
     
    313284    implements(IAuthenticator)
    314285
    315     obey_remote_user_header = BoolOption('trac', 'obey_remote_user_header', 'false',
    316                """Whether the 'Remote-User:' HTTP header is to be trusted for user logins
    317                 (''since ??.??').""")
     286    obey_remote_user_header = BoolOption('trac', 'obey_remote_user_header', 'false', 
     287               """Whether the 'Remote-User:' HTTP header is to be trusted for user logins 
     288                (''since ??.??').""") 
    318289
    319290    def authenticate(self, req):
    320         if self.obey_remote_user_header and req.get_header('Remote-User'):
    321             return req.get_header('Remote-User')
     291        if self.obey_remote_user_header and req.get_header('Remote-User'): 
     292            return req.get_header('Remote-User') 
    322293        return None
    323294
    324295}}}
    325296
    326 TracIni にパラメータを追加します:
    327 {{{
    328 ...
     297Add this new parameter to your TracIni:
     298{{{#!ini
    329299[trac]
    330300...
     
    333303}}}
    334304
    335 tracd を起動します:
    336 {{{
    337 tracd -p 8101 -r -s proxified --base-path=/project/proxified
    338 }}}
    339 
    340 もしプラグインをすべてのプロジェクトにインストールしたい場合、 [TracPlugins#Plugindiscovery 共有pluginsディレクトリ] に格納し、共有 trac.ini でプラグインのコンポーネントを有効に設定しなければいけません。
    341 
    342 共有 config (例えば `/srv/trac/conf/trac.ini`):
    343 {{{
     305Run tracd:
     306{{{#!sh
     307tracd -p 8101 -s proxified --base-path=/project/proxified
     308}}}
     309
     310Note that if you want to install this plugin for all projects, you have to put it in your [TracPlugins#Plugindiscovery global plugins_dir] and enable it in your global trac.ini.
     311
     312Global config (e.g. `/srv/trac/conf/trac.ini`):
     313{{{#!ini
    344314[components]
    345315remote-user-auth.* = enabled
     
    350320}}}
    351321
    352 各プロジェクトの config (例えば `/srv/trac/envs/myenv`):
    353 {{{
     322Environment config (e.g. `/srv/trac/envs/myenv`):
     323{{{#!ini
    354324[inherit]
    355325file = /srv/trac/conf/trac.ini
    356326}}}
    357327
    358 ===  / (root) とは異なるベースパスで起動する === #Servingadifferentbasepaththan
    359 Tracd は /<project> とは異なるベース URL でプロジェクトを提供することをサポートします。変更するためのパラメータは以下の通りです。
    360 {{{
     328=== Serving a different base path than /
     329Tracd supports serving projects with different base urls than /<project>. The parameter name to change this is
     330{{{#!sh
    361331 $ tracd --base-path=/some/path
    362332}}}
    363333
    364334----
    365 See also: TracInstall, TracCgi, TracModPython, TracGuide, [trac:TracOnWindowsStandalone#RunningTracdasservice Windows 上での tracd.exe の実行]
     335See also: TracInstall, TracCgi, TracModPython, TracGuide, [trac:TracOnWindowsStandalone#RunningTracdasservice Running tracd.exe as a Windows service]