| 94 | | or you can uncompress the Genshi egg to resolve problems extracting from it. |
| 95 | | |
| 96 | | === Configuring Authentication === |
| 97 | | |
| 98 | | See corresponding section in the [wiki:TracModWSGI#ConfiguringAuthentication] page. |
| 99 | | |
| 100 | | |
| 101 | | == Advanced Configuration |
| 102 | | |
| 103 | | === Setting the Python Egg Cache === |
| 104 | | |
| 105 | | If the Egg Cache isn't writeable by your Web server, you'll either have to change the permissions, or point Python to a location where Apache can write. This can manifest itself as a ''500 internal server error'' and/or a complaint in the syslog. |
| | 94 | 又は Genshi の egg を解凍して展開することで、この問題を回避できます。 |
| | 95 | |
| | 96 | === 認証設定 === #ConfiguringAuthentication |
| | 97 | |
| | 98 | [wiki:TracModWSGI#ConfiguringAuthentication] ページの対応する項目を参照してください。 |
| | 99 | |
| | 100 | |
| | 101 | == 詳細な設定 == #AdvancedConfiguration |
| | 102 | |
| | 103 | === Python Egg Cache を設定する === #SettingthePythonEggCache |
| | 104 | |
| | 105 | Web サーバが Egg Cache に書き込みできない場合、パーミッションを変更するか、 Apache が書き込み可能な場所を指定する必要があります。設定しないと ''500 Internal Server Error'' や syslog へのエラー出力が発生します。 |
| 192 | | This does not seem to work in all cases. What you can do if it does not: |
| 193 | | * Try using `<LocationMatch>` instead of `<Location>` |
| 194 | | * <Location /> may, in your server setup, refer to the complete host instead of simple the root of the server. This means that everything (including the login directory referenced below) will be sent to python and authentication does not work (i.e. you get the infamous Authentication information missing error). If this applies to you, try using a sub-directory for trac instead of the root (i.e. /web/ and /web/login instead of / and /login). |
| 195 | | * Depending on apache's `NameVirtualHost` configuration, you may need to use `<VirtualHost *:80>` instead of `<VirtualHost *>`. |
| 196 | | |
| 197 | | For a virtual host that supports multiple projects replace "`TracEnv`" /var/trac/myproject with "`TracEnvParentDir`" /var/trac/ |
| 198 | | |
| 199 | | Note: !DocumentRoot should not point to your Trac project env. As Asmodai wrote on #trac: "suppose there's a webserver bug that allows disclosure of !DocumentRoot they could then leech the entire Trac environment". |
| 200 | | |
| 201 | | == Troubleshooting == |
| 202 | | |
| 203 | | In general, if you get server error pages, you can either check the Apache error log, or enable the `PythonDebug` option: |
| | 192 | この設定は全てのケースでうまく動くわけではありません。動かない場合は以下を試してください: |
| | 193 | * `<Location>` の代わりに `<LocationMatch>` を使用する |
| | 194 | * <Location /> はサーバの設定によっては、単にサーバのルートではなく完全なホスト名を参照していることがあります。このような場合、 (上記の例では下段にあたるログイン用ディレクトリを含む) 全てのリクエストが Python に送信され、認証が動かなくなります (認証を行おうとすると、認証が設定されていないというエラー画面が表示されます)。 URL を変更できるのであれば (/, /login の代わりに /web/, /web/login などのように) ルートではなくサブディレクトリを使ってみてください |
| | 195 | * Apache の `NameVirtualHost` を設定している場合、 `<VirtualHost *>` ではなく `<VirtualHost *:80>` を使用せねばならないかもしれません |
| | 196 | |
| | 197 | 複数のプロジェクトをサポートする仮想ホストの設定では、 "`TracEnv`" /var/trac/myproject を "`TracEnvParentDir`" /var/trac/ に置き換えて下さい。 |
| | 198 | |
| | 199 | Note: !DocumentRoot は TracEnvironment と同じディレクトリにしないでください。 何かのバグがあった場合に TracEnvironment の内容が外部からアクセス可能になってしまうおそれがあります。 |
| | 200 | |
| | 201 | == トラブルシューティング == #Troubleshooting |
| | 202 | |
| | 203 | サーバエラーのページがでたときには、 まずは Apache のエラーログを確認するか、 `PythonDebug` オプションを有効にして下さい: |
| 248 | | This problem will most certainly hit you on Unix when using Python 2.4. |
| 249 | | In Python 2.4, some version of Expat (an XML parser library written in C) is used, |
| 250 | | and if Apache is using another version, this results in segmentation faults. |
| 251 | | As Trac 0.11 is using Genshi, which will indirectly use Expat, that problem |
| 252 | | can now hit you even if everything was working fine before with Trac 0.10. |
| 253 | | |
| 254 | | See Graham Dumpleton's detailed [http://www.dscpl.com.au/wiki/ModPython/Articles/ExpatCausingApacheCrash explanation and workarounds] for the issue. |
| 255 | | |
| 256 | | === Form submission problems === |
| 257 | | |
| 258 | | If you're experiencing problems submitting some of the forms in Trac (a common problem is that you get redirected to the start page after submission), check whether your {{{DocumentRoot}}} contains a folder or file with the same path that you mapped the mod_python handler to. For some reason, mod_python gets confused when it is mapped to a location that also matches a static resource. |
| 259 | | |
| 260 | | === Problem with virtual host configuration === |
| 261 | | |
| 262 | | If the <Location /> directive is used, setting the `DocumentRoot` may result in a ''403 (Forbidden)'' error. Either remove the `DocumentRoot` directive, or make sure that accessing the directory it points is allowed (in a corresponding `<Directory>` block). |
| 263 | | |
| 264 | | Using <Location /> together with `SetHandler` resulted in having everything handled by mod_python, which leads to not being able download any CSS or images/icons. I used <Location /trac> `SetHandler None` </Location> to circumvent the problem, though I do not know if this is the most elegant solution. |
| 265 | | |
| 266 | | === Problem with zipped egg === |
| 267 | | |
| 268 | | It's possible that your version of mod_python will not import modules from zipped eggs. If you encounter an `ImportError: No module named trac` in your Apache logs but you think everything is where it should be, this might be your problem. Look in your site-packages directory; if the Trac module appears as a ''file'' rather than a ''directory'', then this might be your problem. To rectify, try installing Trac using the `--always-unzip` option, like this: |
| 269 | | |
| 270 | | {{{ |
| 271 | | easy_install --always-unzip Trac-0.12b1.zip |
| 272 | | }}} |
| 273 | | |
| 274 | | === Using .htaccess === |
| 275 | | |
| 276 | | Although it may seem trivial to rewrite the above configuration as a directory in your document root with a `.htaccess` file, this does not work. Apache will append a "/" to any Trac URLs, which interferes with its correct operation. |
| 277 | | |
| 278 | | It may be possible to work around this with mod_rewrite, but I failed to get this working. In all, it is more hassle than it is worth. Stick to the provided instructions. :) |
| 279 | | |
| 280 | | A success story: For me it worked out-of-box, with following trivial config: |
| | 248 | この問題は Unix 上で Python 2.4 を使用するとき、ほぼ確実に発生します。 |
| | 249 | Python 2.4 の使用する Expat (C で書かれた XML パーザライブラリ) と |
| | 250 | Apache の使用する Expat のバージョンが異なる場合に、セグメンテーションフォルトが発生します。 |
| | 251 | Trac 0.11 は Genshi (間接的に Expat が使用される) を使用しているため、 |
| | 252 | 以前 Trac 0.10 で正常に動いていたとしても、現在のあなたの環境で問題が起こり得ます。 |
| | 253 | |
| | 254 | Graham Dumpleton が、この問題について詳しく書いています。問題の [http://www.dscpl.com.au/wiki/ModPython/Articles/ExpatCausingApacheCrash 説明と回避方法] を確認してください。 |
| | 255 | |
| | 256 | === フォームを送信するときの問題 === #Formsubmissionproblems |
| | 257 | |
| | 258 | もし、 Trac で何かしらのフォームを送信したときに、トラブルに見舞われたら (送信後にスタートページにリダイレクトされてしまう、などがよくある問題です) {{{DocumentRoot}}} の中に mod_python をマッピングしたパスと同じフォルダやファイルが存在しないか確認してください。どういうわけか、 mod_python は静的リソースと同じところにマッピングされると混乱してしまいます。 |
| | 259 | |
| | 260 | === 仮想ホストの設定においての問題 === #Problemwithvirtualhostconfiguration |
| | 261 | |
| | 262 | <Location /> ディレクティブが使用されている場合に `DocumentRoot` を設定すると ''403 (Forbidden)'' エラーになることがあります。 `DocumentRoot` ディレクティブを削除するか、アクセスが許されているディレクトリに設定されているかどうかを確認して下さい (対応する `<Directory>` ブロックにて) |
| | 263 | |
| | 264 | <Location /> で `SetHandler` を使用すると、すべてを mod_python でハンドルすることになりますが、いかなる CSS も image/icons もダウンロードできなくなります。この問題を回避するために、われわれは <Location /trac> で `SetHandler None` を使用しています。しかし、この方法がエレガントな解決方法だとは思っていません。 |
| | 265 | |
| | 266 | === Zip された egg での問題 === #Problemwithzippedegg |
| | 267 | |
| | 268 | mod_python のバージョンによっては Zip された egg ファイルからモジュールを import できないことがあります。 Apache のログに `ImportError: No module named trac` が出力される場合、問題が発生している原因であると考えられます。 Python の site-packages ディレクトリを見てみてください。 Trac のモジュールが ''ディレクトリ'' ではなく ''ファイル'' として配置されている場合、問題の原因と考えられます。解決するためには、下記の上に `--always-unzip` オプションと伴に Trac をインストールしてみてください。 |
| | 269 | |
| | 270 | {{{ |
| | 271 | easy_install --always-unzip Trac-0.12.zip |
| | 272 | }}} |
| | 273 | |
| | 274 | === .htaccess ファイルを使用する === #Using.htaccess |
| | 275 | |
| | 276 | ディレクトリの設定をほんのちょっと修正するには `.htaccess` ファイルを使用すればいいかもしれませんが、これは動作しません。 Apache が Trac の URL に "/" (スラッシュ) を追加すると、正しい動作を妨げてしまいます。 |
| | 277 | |
| | 278 | それでは、 mod_rewrite を使用すればいいように見えますが、これも動作しません。とにかく、百害あって一利なしです。指示に従ってください。 :) |
| | 279 | |
| | 280 | 成功した事例: 以下の設定値で成功した事例があります: |
| 306 | | === Platform specific issues |
| 307 | | ==== Win32 Issues ==== |
| 308 | | If you run trac with mod_python < 3.2 on Windows, uploading attachments will '''not''' work. This problem is resolved in mod_python 3.1.4 or later, so please upgrade mod_python to fix this. |
| 309 | | |
| 310 | | |
| 311 | | ==== OS X issues ==== |
| 312 | | |
| 313 | | When using mod_python on OS X you will not be able to restart Apache using `apachectl restart`. This is apparently fixed in mod_python 3.2, but there's also a patch available for earlier versions [http://www.dscpl.com.au/projects/vampire/patches.html here]. |
| 314 | | |
| 315 | | ==== SELinux issues ==== |
| 316 | | |
| 317 | | If Trac reports something like: ''Cannot get shared lock on db.lock'' |
| 318 | | The security context on the repository may need to be set: |
| | 306 | === 特定のプラットフォームでの問題 === #Platformspecificissues |
| | 307 | ==== Win32 での問題 ==== #Win32issues |
| | 308 | Windows 上で mod_python 3.2 より前のバージョンで Trac を動かしている場合、添付ファイルのアップロードが '''動かない''' でしょう。この問題は 3.1.4 以降で解決されました。 mod_python をアップグレードしてこの問題を解決してください。 |
| | 309 | |
| | 310 | |
| | 311 | ==== OS X での問題 ==== #OSXissues |
| | 312 | |
| | 313 | OS X で mod_python を使用するとき、 `apachectl restart` コマンドで Apache の再起動ができないでしょう。これは、 mod_python 3.2 でおそらく修正されるでしょう。しかし、 [http://www.dscpl.com.au/projects/vampire/patches.html ここ] にあるパッチを適用すれば、 3.2 以前のバージョンでもこの問題を回避できます。 |
| | 314 | |
| | 315 | ==== SELinux での問題 ==== #SELinuxissues |
| | 316 | |
| | 317 | もし、 Trac が ''Cannot get shared lock on db.lock'' というようなメッセージが出力したら、 |
| | 318 | リポジトリに セキュリティコンテキストを設定する必要があるでしょう: |
| 324 | | See also [http://subversion.tigris.org/faq.html#reposperms] |
| 325 | | |
| 326 | | ==== FreeBSD issues ==== |
| 327 | | Pay attention to the version of the installed mod_python and sqlite packages. Ports have both the new and old ones, but earlier versions of pysqlite and mod_python won't integrate as the former requires threaded support in python, and the latter requires a threadless install. |
| 328 | | |
| 329 | | If you compiled and installed apache2, apache wouldn´t support threads (cause it doesn´t work very well on FreeBSD). You could force thread support when running ./configure for apache, using --enable-threads, but this isn´t recommendable. |
| 330 | | The best option [http://modpython.org/pipermail/mod_python/2006-September/021983.html seems to be] adding to /usr/local/apache2/bin/ennvars the line |
| | 324 | [http://subversion.tigris.org/faq.html#reposperms] も参考にして下さい |
| | 325 | |
| | 326 | ==== FreeBSD での問題 ==== #FreeBSDissues |
| | 327 | mod_python と sqlite パッケージのインストールバージョンに注意して下さい。 Ports には両パッケージともいろいろなバージョンがありますが、初期の pysqlite と mod_python は組み合わせることができません。前者は python のスレッド機能サポートが必要ですし、 後者 は python のスレッド機能なしのインストールが必要です。 |
| | 328 | |
| | 329 | apache2 を普通にコンパイルしてインストールした場合、 apache はスレッドのサポートなしになります (これが FreeBSD 上であまりよく動かない原因)。 --enable-threads を使用して ./configure を実行することで apache にスレッドのサポートありにすることができますが、これはお勧めできません。 |
| | 330 | 最良のオプションは /usr/local/apache2/bin/ennvars に下記の一行を追加することだと [http://modpython.org/pipermail/mod_python/2006-September/021983.html 考えられます。] |
| 337 | | ==== Fedora 7 Issues ==== |
| 338 | | Make sure you install the 'python-sqlite2' package as it seems to be required for TracModPython but not for tracd |
| 339 | | |
| 340 | | |
| 341 | | === Subversion issues === |
| 342 | | |
| 343 | | If you get the following Trac Error `Unsupported version control system "svn"` only under mod_python, though it works well on the command-line and even with TracStandalone, chances are that you forgot to add the path to the Python bindings with the [TracModPython#ConfiguringPythonPath PythonPath] directive. (The better way is to add a link to the bindings in the Python `site-packages` directory, or create a `.pth` file in that directory.) |
| 344 | | |
| 345 | | If this is not the case, it's possible that you're using Subversion libraries that are binary incompatible with the apache ones (an incompatibility of the `apr` libraries is usually the cause). In that case, you also won't be able to use the svn modules for Apache (`mod_dav_svn`). |
| 346 | | |
| 347 | | You also need a recent version of `mod_python` in order to avoid a runtime error ({{{argument number 2: a 'apr_pool_t *' is expected}}}) due to the default usage of multiple sub-interpreters. 3.2.8 ''should'' work, though it's probably better to use the workaround described in [trac:#3371 #3371], in order to force the use of the main interpreter: |
| | 337 | ==== Fedora 7 での問題 ==== #Fedore7Issues |
| | 338 | 'python-sqlite2' を必ずインストールしてください。tracd では必須ではありませんが、 TracModPython では必須です。 |
| | 339 | |
| | 340 | |
| | 341 | === Subversion での問題 === #Subversionissues |
| | 342 | |
| | 343 | コマンドラインや TracStandalone で使用しているときは動くのに、 mod_python を使用しているときのみ、 `Unsupported version control system "svn"` というエラーが出力される場合、 [wiki:"TracModPython#SettingthePythonPath" PythonPath] ディレクティブに Python bindings へのパスを追加するのを忘れている可能性があります。 (Python の `site-packages` ディレクトリに Python binding へのリンクを追加するか、 `.pth` ファイルを作っておくのがベターです。) |
| | 344 | |
| | 345 | これに当てはまらない場合、使用している Subversion のライブラリが Apache が使用しているバージョンと適合性がないかもしれません。 (たいてい `apr` ライブラリの不適合性が原因になります。) その場合、 Apache の svn モジュール (`mod_dav_svn`) も使用できないでしょう。 |
| | 346 | |
| | 347 | また、ランタイムエラー ({{{argument number 2: a 'apr_pool_t *' is expected}}}) を抑止するためにも、複数のサブインタプリタを使用できる最近のバージョンの `mod_python` が必要になります。 3.2.8 では ''たぶん'' 動きますが、 [trac:#3371] に記述されている通り、メインインタプリタを使用するように強制するワークアラウンドを使用する方がおそらく良いでしょう: |
| 364 | | Note: For the above configuration to have any effect it must be put after the configuration of your project root location, i.e. {{{<Location /myproject />}}}. |
| 365 | | |
| 366 | | Also, setting `PythonOptimize On` seems to mess up the page headers and footers, in addition to hiding the documentation for macros and plugins (see #Trac8956). Considering how little effect the option has, it is probably a good idea to leave it `Off`. |
| 367 | | |
| 368 | | === HTTPS issues === |
| 369 | | |
| 370 | | If you want to run Trac fully under https you might find that it tries to redirect to plain http. In this case just add the following line to your apache configuration: |
| | 364 | Note: 上記のコンフィグが効果を発揮するためには、プロジェクトの root 位置のコンフィグ後に追加しなければなりません。つまり {{{<Location /myproject />}}} 以降です。 |
| | 365 | |
| | 366 | また `PythonOptimize On` が設定されている場合、ページのヘッダとフッタの表示が乱れたり、マクロやプラグインのドキュメンテーションが表示されないことがあります ([trac:#8956] 参照)。オプションの設定によって影響を受ける箇所について充分考慮できない場合は `Off` に設定する方がよいでしょう。 |
| | 367 | |
| | 368 | === HTTPS の問題 === #HTTPSissues |
| | 369 | |
| | 370 | Trac を完全に https で実行したいにも関わらず、プレーンな http にリダイレクトされる場合、 Apache のコンフィグに以下を追加してください: |