Changes between Version 4 and Version 5 of TracFastCgi
- Timestamp:
- 05/08/22 15:12:27 (3 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TracFastCgi
v4 v5 4 4 [[PageOutline(2-5, Contents, floated)]] 5 5 6 [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 a much wider variety of web servers.7 8 Note that unlike mod_python, FastCGI supports [http ://httpd.apache.org/docs/suexec.html Apache SuEXEC], ie run with different permissions than the web server runs with. `mod_wsgi` supports the `WSGIDaemonProcess` with user / group parameters to achieve the same effect.6 [https://fastcgi-archives.github.io 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 a much wider variety of web servers. 7 8 Note that unlike mod_python, FastCGI supports [https://httpd.apache.org/docs/suexec.html Apache SuEXEC], ie run with different permissions than the web server runs with. `mod_wsgi` supports the `WSGIDaemonProcess` with user / group parameters to achieve the same effect. 9 9 10 10 '''Note for Windows:''' Trac's FastCGI does not run under Windows, as Windows does not implement `Socket.fromfd`, which is used by `_fcgi.py`. If you want to connect to IIS, you may want to try [trac:TracOnWindowsIisAjp AJP]/[trac:TracOnWindowsIisAjp ISAPI]. … … 27 27 <IfModule mod_fastcgi.c> 28 28 AddHandler fastcgi-script .fcgi 29 FastCgiIpcDir /var/lib/apache2/fastcgi 29 FastCgiIpcDir /var/lib/apache2/fastcgi 30 30 </IfModule> 31 31 LoadModule fastcgi_module /usr/lib/apache2/modules/mod_fastcgi.so … … 46 46 }}} 47 47 48 You can also specify the `PYTHON_EGG_CACHE` environment variable using a second `-initial-env` directive: 49 {{{#!apache 50 FastCgiConfig -initial-env TRAC_ENV=/var/lib/trac \ 51 -initial-env PYTHON_EGG_CACHE=/var/lib/trac/plugin-cache 52 }}} 53 48 54 === Set up with `mod_fcgid` 49 55 … … 62 68 === Alternative environment setup 63 69 64 A better method to specify the path to the Trac environment is to embed the path into `trac.fcgi` script itself. That doesn't require configuration of the server environment variables, works for both [trac:FastCgi] modules as well as for [http ://www.lighttpd.net/ lighttpd] and CGI:70 A better method to specify the path to the Trac environment is to embed the path into `trac.fcgi` script itself. That doesn't require configuration of the server environment variables, works for both [trac:FastCgi] modules as well as for [https://www.lighttpd.net/ lighttpd] and CGI: 65 71 {{{#!python 66 72 import os … … 100 106 The second rule will be there to serve the few static files needed to correctly display the Trac interface. Create it as ''Directory rule'' for ''/common'' and just set it to the ''Static files'' handler and with a ''Document root'' that points to the appropriate files: ''$TRAC_LOCAL/htdocs/'' (where $TRAC_LOCAL is a directory defined by the user or the system administrator to place local Trac resources). 101 107 102 '''Note:''' If the tracd process fails to start up, and Cherokee displays a 503 error page, you might be missing the [http ://trac.saddi.com/fluppython-flup] package ([trac:#9903]). Python-flup is a dependency which provides Trac with SCGI capability. You can install it on Debian based systems with:108 '''Note:''' If the tracd process fails to start up, and Cherokee displays a 503 error page, you might be missing the [https://www.saddi.com/software/flup/ python-flup] package ([trac:#9903]). Python-flup is a dependency which provides Trac with SCGI capability. You can install it on Debian based systems with: 103 109 {{{#!sh 104 110 sudo apt-get install python-flup … … 107 113 == Lighttpd Configuration 108 114 109 The FastCGI front-end was developed primarily for use with alternative webservers, such as [http ://www.lighttpd.net/ Lighttpd].115 The FastCGI front-end was developed primarily for use with alternative webservers, such as [https://www.lighttpd.net/ Lighttpd]. 110 116 111 117 Lighttpd is a secure, fast, compliant and very flexible web-server that has been optimized for high-performance environments. It has a very low memory footprint compared to other web servers and takes care of CPU load. … … 116 122 var.fcgi_binary="/path/to/cgi-bin/trac.fcgi" # 0.10 name of prior fcgi executable 117 123 fastcgi.server = ("/trac" => 118 124 119 125 ("trac" => 120 126 ("socket" => "/tmp/trac-fastcgi.sock", … … 174 180 # Separated password files for each project 175 181 # See "Conditional Configuration" in 176 # http ://trac.lighttpd.net/trac/file/branches/lighttpd-merge-1.4.x/doc/configuration.txt182 # https://redmine.lighttpd.net/projects/lighttpd/repository/entry/doc/configuration.txt?rev=lighttpd-1.4.28 177 183 178 184 $HTTP["url"] =~ "^/first/" { … … 184 190 185 191 # Enable auth on trac URLs, see 186 # http ://trac.lighttpd.net/trac/file/branches/lighttpd-merge-1.4.x/doc/authentication.txt192 # https://redmine.lighttpd.net/projects/lighttpd/repository/entry/doc/authentication.txt?rev=lighttpd-1.4.28 187 193 188 194 auth.require = ("/first/login" => … … 286 292 == !LiteSpeed Configuration 287 293 288 The FastCGI front-end was developed primarily for use with alternative webservers, such as [http ://www.litespeedtech.com/ LiteSpeed].294 The FastCGI front-end was developed primarily for use with alternative webservers, such as [https://www.litespeedtech.com/ LiteSpeed]. 289 295 290 296 !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. … … 335 341 == Nginx Configuration 336 342 337 [http ://nginx.org/en/ Nginx] is able to communicate with FastCGI processes, but can not spawn them. So you need to start FastCGI server for Trac separately.343 [https://nginx.org/en/ Nginx] is able to communicate with FastCGI processes, but can not spawn them. So you need to start FastCGI server for Trac separately. 338 344 339 345 1. Nginx configuration with basic authentication handled by Nginx - confirmed to work on 0.6.32 … … 411 417 import trac.web._fcgi 412 418 413 fcgiserv = trac.web._fcgi.WSGIServer(dispatch_request, 419 fcgiserv = trac.web._fcgi.WSGIServer(dispatch_request, 414 420 bindAddress = sockaddr, umask = 7) 415 421 fcgiserv.run() … … 432 438 433 439 }}} 434 1. Reload nginx and launch trac.fcgi: 440 1. Reload nginx and launch trac.fcgi: 435 441 {{{#!sh 436 trac@trac.example ~ $ ./trac-standalone-fcgi.py 442 trac@trac.example ~ $ ./trac-standalone-fcgi.py 437 443 }}} 438 444 … … 445 451 * and patch from [trac:#7239] is applied, or you'll have to fix the socket file permissions every time 446 452 447 Unfortunately Nginx does not support variable expansion in fastcgi_pass directive. 448 Thus it is not possible to serve multiple Trac instances from one server block. 449 450 If you worry enough about security, run Trac instances under separate users. 453 Unfortunately Nginx does not support variable expansion in fastcgi_pass directive. 454 Thus it is not possible to serve multiple Trac instances from one server block. 455 456 If you worry enough about security, run Trac instances under separate users. 451 457 452 458 Another way to run Trac as a FCGI external application is offered in [trac:#6224].