Changes between Version 6 and Version 7 of TracFastCgi


Ignore:
Timestamp:
03/24/15 23:15:03 (3 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TracFastCgi

    v6 v7  
     1[[PageOutline]]
     2
    13= Trac with FastCGI =
    2 [[TracGuideToc]]
    3 [[PageOutline(2-5, Contents, floated)]]
    44
    55[http://www.fastcgi.com/ FastCGI] interface allows Trac to remain resident much like with [wiki:TracModPython mod_python] or [wiki:TracModWSGI mod_wsgi]. It is faster than external CGI interfaces which must start a new process for each request.  Additionally, it is supported by much wider variety of web servers.
     
    6767A better method to specify path to Trac environment is to embed the path
    6868into `trac.fcgi` script itself. That doesn't require configuration of server
    69 environment variables, works for both [trac:FastCgi] modules
     69environment variables, works for both FastCgi modules
    7070(and for [http://www.lighttpd.net/ lighttpd] and CGI as well):
    7171{{{
     
    142142using `bin-environment` (as in the section above on Apache configuration).
    143143
    144 Note that lighttpd has a bug related to 'SCRIPT_NAME' and 'PATH_INFO' when the uri of fastcgi.server is '/' instead of '/trac' in this example (see [trac:#2418]). This is fixed in lighttpd 1.5, and under lighttpd 1.4.23 or later the workaround is to add `"fix-root-scriptname" => "enable"` as a parameter of fastcgi.server.
     144Note that lighttpd has a bug related to 'SCRIPT_NAME' and 'PATH_INFO' when the uri of fastcgi.server is '/' instead of '/trac' in this example (see [trac:#2418]). This should be fixed since lighttpd 1.4.23, and you may need to add `"fix-root-scriptname" => "enable"` as parameter of fastcgi.server.
    145145
    146146For using two projects with lighttpd add the following to your `lighttpd.conf`:
     
    371371
    372372 1. Nginx configuration with basic authentication handled by Nginx - confirmed to work on 0.6.32
    373  {{{
     373{{{
    374374    server {
    375375        listen       10.9.8.7:443;
     
    386386        ssl_prefer_server_ciphers   on;
    387387
    388         # it makes sense to serve static resources through Nginx (or ``~ [/some/prefix]/chrome/(.*)``)
    389         location ~ /chrome/(.*) {
    390              alias /home/trac/instance/static/htdocs/$1;
     388        # (Or ``^/some/prefix/(.*)``.
     389        if ($uri ~ ^/(.*)) {
     390             set $path_info /$1;
    391391        }
    392392
    393         # You can copy this whole location to ``location [/some/prefix](/login)``
     393        # it makes sense to serve static resources through Nginx
     394        location /chrome/ {
     395             alias /home/trac/instance/static/htdocs/;
     396        }
     397
     398        # You can copy this whole location to ``location [/some/prefix]/login``
    394399        # and remove the auth entries below if you want Trac to enforce
    395400        # authorization where appropriate instead of needing to authenticate
    396401        # for accessing the whole site.
    397         # (Or ``~ location /some/prefix(/.*)``.)
    398         location ~ (/.*) {
     402        # (Or ``location /some/prefix``.)
     403        location / {
    399404            auth_basic            "trac realm";
    400405            auth_basic_user_file /home/trac/htpasswd;
     
    410415            # (Or ``fastcgi_param  SCRIPT_NAME  /some/prefix``.)
    411416            fastcgi_param  SCRIPT_NAME        "";
    412             fastcgi_param  PATH_INFO          $1;
     417            fastcgi_param  PATH_INFO          $path_info;
    413418
    414419            ## WSGI NEEDED VARIABLES - trac warns about them
     
    433438    }
    434439}}}
    435  1. Modified trac.fcgi:
    436  {{{
     440
     441 2. Modified trac.fcgi:
     442
     443{{{
    437444#!/usr/bin/env python
    438445import os
     
    465472
    466473}}}
    467  1. reload nginx and launch trac.fcgi like that:
    468  {{{#!sh
     474
     475 3. reload nginx and launch trac.fcgi like that:
     476
     477{{{
    469478trac@trac.example ~ $ ./trac-standalone-fcgi.py
    470479}}}