27 | | Configure `ScriptAlias` or similar options as described in TracCgi, but calling `trac.fcgi` instead of `trac.cgi`. |
28 | | |
29 | | In Kubuntu, with libapache2_fcgid (version 1.07), the above did not work, with the error |
30 | | {{{ |
31 | | Invalid command 'FastCgiConfig', perhaps mis-spelled or |
32 | | defined by a module not included in the server configuration. |
33 | | }}} |
34 | | when apache is started. The solution was to use |
| 39 | But neither of these will work for `mod_fcgid`. A similar but partial |
| 40 | solution for `mod_fcgid` is: |
| 44 | But this cannot be used in `Directory` or `Location` context, which makes it |
| 45 | difficult to support multiple projects. |
| 46 | |
| 47 | A better method which works for both of these modules (and for `lighttpd` and |
| 48 | CGI as well), because it involves no server configuration settings for |
| 49 | environment variables, is to set one of these variables in `trac.fcgi`, e.g.: |
| 50 | {{{ |
| 51 | import os |
| 52 | os.environ['TRAC_ENV'] = "/path/to/projectenv" |
| 53 | }}} |
| 54 | or |
| 55 | {{{ |
| 56 | import os |
| 57 | os.environ['TRAC_ENV_PARENT_DIR'] = "/path/to/project/parent/dir" |
| 58 | }}} |
| 59 | |
| 60 | Using this method, different projects can be supported by using different |
| 61 | `.cgi` scripts with different `ScriptAliases`, copying and appropriately |
| 62 | renaming `trac.fcgi` and adding the above code to create each such script. |
60 | | Note that you will need to add a new entry to `fastcgi.server` for each separate Trac instance that you wish to run. Alternatively, you may use the `TRAC_ENV_PARENT_DIR` variable instead of `TRAC_ENV` as described above. |
61 | | |
62 | | For using two projects with lighttpd add the following to your lighttpd.conf: |
| 85 | Note that you will need to add a new entry to `fastcgi.server` for each separate Trac instance that you wish to run. Alternatively, you may use the `TRAC_ENV_PARENT_DIR` variable instead of `TRAC_ENV` as described above, |
| 86 | and you may set one of the two in `trac.fcgi` instead of in `lighttpd.conf` |
| 87 | using `bin-environment` (as in the section above on Apache configuration). |
| 88 | |
| 89 | For using two projects with lighttpd add the following to your `lighttpd.conf`: |
84 | | Note that field values are different. |
| 111 | Note that field values are different. If you prefer setting the environment |
| 112 | variables in the `.fcgi` scripts, then copy/rename `trac.fcgi`, e.g., to |
| 113 | `first.fcgi` and `second.fcgi`, and reference them in the above settings. |
| 114 | Note that the above will result in different processes in any event, even |
| 115 | if both are running from the same `trac.fcgi` script. |