|   | 1 | = Trac with FastCGI =  | 
                  
                          |   | 2 |   | 
                  
                          |   | 3 | Since version 0.9, Trac supports being run through the [http://www.fastcgi.com/ FastCGI] interface. Like [wiki:TracModPython mod_python], this allows Trac to remain resident, and is faster than external CGI interfaces which must start a new process for each request. However, unlike mod_python, it is able to support [http://httpd.apache.org/docs/suexec.html SuEXEC]. Additionally, it is supported by much wider variety of web servers.  | 
                  
                          |   | 4 |   | 
                  
                          |   | 5 | == Simple Apache configuration ==  | 
                  
                          |   | 6 | {{{  | 
                  
                          |   | 7 | # Enable fastcgi for .fcgi files  | 
                  
                          |   | 8 | # (If you're using a distro package for mod_fcgi, something like  | 
                  
                          |   | 9 | # this is probably already present)  | 
                  
                          |   | 10 | <IfModule mod_fastcgi.c>  | 
                  
                          |   | 11 |    AddHandler fastcgi-script .fcgi  | 
                  
                          |   | 12 |    FastCgiIpcDir /var/lib/apache2/fastcgi   | 
                  
                          |   | 13 | </IfModule>  | 
                  
                          |   | 14 | LoadModule fastcgi_module /usr/lib/apache2/modules/mod_fastcgi.so  | 
                  
                          |   | 15 | }}}  | 
                  
                          |   | 16 |   | 
                  
                          |   | 17 | You can either setup the `TRAC_ENV` as an overall default:  | 
                  
                          |   | 18 | {{{  | 
                  
                          |   | 19 | FastCgiConfig -initial-env TRAC_ENV=/path/to/env/trac  | 
                  
                          |   | 20 | }}}  | 
                  
                          |   | 21 |   | 
                  
                          |   | 22 | Or you can serve multiple Trac projects in a directory like:  | 
                  
                          |   | 23 | {{{  | 
                  
                          |   | 24 | FastCgiConfig -initial-env TRAC_ENV_PARENT_DIR=/parent/dir/of/projects  | 
                  
                          |   | 25 | }}}  | 
                  
                          |   | 26 |   | 
                  
                          |   | 27 | Configure `ScriptAlias` or similar options as described in TracCgi, but calling `trac.fcgi` instead of `trac.cgi`.  | 
                  
                          |   | 28 |   | 
                  
                          |   | 29 | == Simple Lighttpd Configuration ==  | 
                  
                          |   | 30 |   | 
                  
                          |   | 31 | The FastCGI front-end was developed primarily for use with alternative webservers, such as [http://www.lighttpd.net/ lighttpd].  | 
                  
                          |   | 32 |   | 
                  
                          |   | 33 | lighttpd is a secure, fast, compliant and very flexible web-server that has been optimized for high-performance  | 
                  
                          |   | 34 | environments.  It has a very low memory footprint compared to other web servers and takes care of CPU load.  | 
                  
                          |   | 35 |   | 
                  
                          |   | 36 | For using `trac.fcgi` with lighttpd add the following to your lighttpd.conf:  | 
                  
                          |   | 37 | {{{  | 
                  
                          |   | 38 | fastcgi.server = ("/trac" =>  | 
                  
                          |   | 39 |                    ("trac" =>  | 
                  
                          |   | 40 |                      ("socket" => "/tmp/trac-fastcgi.sock",  | 
                  
                          |   | 41 |                       "bin-path" => "/path/to/cgi-bin/trac.fcgi",  | 
                  
                          |   | 42 |                       "check-local" => "disable",  | 
                  
                          |   | 43 |                       "bin-environment" =>  | 
                  
                          |   | 44 |                         ("TRAC_ENV" => "/path/to/projenv")  | 
                  
                          |   | 45 |                      )  | 
                  
                          |   | 46 |                    )  | 
                  
                          |   | 47 |                  )  | 
                  
                          |   | 48 | }}}  | 
                  
                          |   | 49 |   | 
                  
                          |   | 50 | 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.  | 
                  
                          |   | 51 |   | 
                  
                          |   | 52 | Other important information like [http://trac.lighttpd.net/trac/wiki/TracInstall this updated TracInstall page], [wiki:TracCgi#MappingStaticResources and this] are useful for non-fastcgi specific installation aspects.  | 
                  
                          |   | 53 |   | 
                  
                          |   | 54 | Relaunch lighttpd, and browse to `http://yourhost.example.org/trac` to access Trac.  | 
                  
                          |   | 55 |   | 
                  
                          |   | 56 | ----  | 
                  
                          |   | 57 | See also TracCgi, TracModPython, TracInstall, TracGuide  |