Changes between Version 1 and Version 2 of TracFastCgi


Ignore:
Timestamp:
Oct 20, 2012 6:38:18 PM (12 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TracFastCgi

    v1 v2  
    4545
    4646To setup Trac environment for `mod_fcgid` it is necessary to use
    47 `FCGIDDefaultInitEnv` directive. It cannot be used in `Directory` or
     47`DefaultInitEnv` directive. It cannot be used in `Directory` or
    4848`Location` context, so if you need to support multiple projects, try
    4949alternative environment setup below.
    5050
    5151{{{
    52 FCGIDDefaultInitEnv TRAC_ENV /path/to/env/trac/
     52DefaultInitEnv TRAC_ENV /path/to/env/trac/
    5353}}}
    5454
     
    9494After doing this, we will just have to create a new rule managed by the SCGI handler to access Trac. It can be created in a new virtual server, trac.example.net for instance, and will only need two rules. The '''default''' one will use the SCGI handler associated to the previously created information source.
    9595The second rule will be there to serve the few static files needed to correctly display the Trac interface. Create it as ''Directory rule'' for ''/chrome/common'' and just set it to the ''Static files'' handler and with a ''Document root'' that points to the appropriate files: ''/usr/share/trac/htdocs/''
     96
     97Note:\\
     98If the tracd process fails to start up, and cherokee displays a 503 error page, you might be missing the [http://trac.saddi.com/flup python-flup] package.\\
     99Python-flup is a dependency which provides trac with SCGI capability. You can install it on debian based systems with:
     100{{{
     101sudo apt-get install python-flup
     102}}}
    96103
    97104== Simple Lighttpd Configuration ==
     
    122129and you may set one of the two in `trac.fcgi` instead of in `lighttpd.conf`
    123130using `bin-environment` (as in the section above on Apache configuration).
     131
     132Note 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 #Trac2418. This should be fixed since lighttpd 1.4.23, and you may need to add `"fix-root-scriptname" => "enable"` as parameter of fastcgi.server.
    124133
    125134For using two projects with lighttpd add the following to your `lighttpd.conf`:
     
    275284Note about running lighttpd with reduced permissions:
    276285
    277   If nothing else helps and trac.fcgi doesn't start with lighttpd settings __server.username = "www-data"__, __server.groupname = "www-data"__, then in the `bin-environment` section set `PYTHON_EGG_CACHE` to the home directory of `www-data` or some other directory accessible to this account for writing.
     286  If nothing else helps and trac.fcgi doesn't start with lighttpd settings `server.username = "www-data"`, `server.groupname = "www-data"`, then in the `bin-environment` section set `PYTHON_EGG_CACHE` to the home directory of `www-data` or some other directory accessible to this account for writing.
    278287
    279288
     
    284293!LiteSpeed web server is an event-driven asynchronous Apache replacement designed from the ground-up to be secure, scalable, and operate with minimal resources. !LiteSpeed can operate directly from an Apache config file and is targeted for business-critical environments.
    285294
    286 Setup
    287 
    288 1) Please make sure you have first have a working install of a Trac project. Test install with “tracd” first.
    289 
    290 2) Create a Virtual Host for this setup. From now on we will refer to this vhost as TracVhost. For this tutorial we will be assuming that your trac project will be accessible via:
     295=== Setup ===
     296
     297 1. Please make sure you have first have a working install of a Trac project. Test install with “tracd” first.
     298
     299 2. Create a Virtual Host for this setup. From now on we will refer to this vhost as !TracVhost. For this tutorial we will be assuming that your trac project will be accessible via:
    291300
    292301{{{
     
    294303}}}
    295304
    296 3) Go “TracVhost → External Apps” tab and create a new “External Application”.
     305 3. Go “!TracVhost → External Apps” tab and create a new “External Application”.
    297306
    298307{{{
     
    312321}}}
    313322
    314 4) Optional. If you need to use htpasswd based authentication. Go to “TracVhost → Security” tab and create a new security “Realm”.
     323 4. Optional. If you need to use htpasswd based authentication. Go to “!TracVhost → Security” tab and create a new security “Realm”.
    315324
    316325{{{
     
    322331If you don’t have a htpasswd file or don’t know how to create the entries within one, go to http://sherylcanter.com/encrypt.php, to generate the user:password combos.
    323332
    324 5) Go to “PythonVhost → Contexts” and create a new “FCGI Context”.
     333 5. Go to “!PythonVhost → Contexts” and create a new “FCGI Context”.
    325334
    326335{{{
     
    330339}}}
    331340
    332 6) Modify /fullpathto/mytracproject/conf/trac.ini
     341 6. Modify `/fullpathto/mytracproject/conf/trac.ini`
    333342
    334343{{{
     
    339348}}}
    340349
    341 7) Restart !LiteSpeed, “lswsctrl restart”, and access your new Trac project at:
     350 7. Restart !LiteSpeed, “lswsctrl restart”, and access your new Trac project at:
    342351
    343352{{{
     
    345354}}}
    346355
    347 === Simple Nginx Configuration ===
    348 
    349 1) Nginx configuration snippet - confirmed to work on 0.6.32
     356== Simple Nginx Configuration ==
     357
     358 1. Nginx configuration snippet - confirmed to work on 0.6.32
    350359{{{
    351360    server {
     
    394403            fastcgi_param  SERVER_PORT        $server_port;
    395404            fastcgi_param  SERVER_PROTOCOL    $server_protocol;
     405            fastcgi_param  QUERY_STRING     $query_string;
    396406
    397407            # for authentication to work
     
    402412}}}
    403413
    404 2) Modified trac.fcgi:
     414 2. Modified trac.fcgi:
    405415
    406416{{{
     
    436446}}}
    437447
    438 3) reload nginx and launch trac.fcgi like that:
     448 3. reload nginx and launch trac.fcgi like that:
    439449
    440450{{{
     
    444454The above assumes that:
    445455 * There is a user named 'trac' for running trac instances and keeping trac environments in its home directory.
    446  * /home/trac/instance contains a trac environment
    447  * /home/trac/htpasswd contains authentication information
    448  * /home/trac/run is owned by the same group the nginx runs under
    449   * and if your system is Linux the /home/trac/run has setgid bit set (chmod g+s run)
     456 * `/home/trac/instance` contains a trac environment
     457 * `/home/trac/htpasswd` contains authentication information
     458 * `/home/trac/run` is owned by the same group the nginx runs under
     459  * and if your system is Linux the `/home/trac/run` has setgid bit set (`chmod g+s run`)
    450460  * and patch from ticket #T7239 is applied, or you'll have to fix the socket file permissions every time
    451461