Changes between Version 1 and Version 2 of TracFastCgi
- Timestamp:
- 04/09/08 13:31:38 (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TracFastCgi
v1 v2 2 2 3 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 {{{ 6 #!html 7 <p style="background: #fdc; border: 2px solid #d00; font-style: italic; padding: 0 .5em; margin: 1em 0;"> 8 <strong>Note for Windows:</strong> Trac's FCGI does not run under Windows, as Windows does not implement Socket.fromfd, which is used by _fcgi.py 9 </p> 10 }}} 4 11 5 12 == Simple Apache configuration == … … 7 14 There are two FastCGI modules commonly available for Apache: `mod_fastcgi` and 8 15 `mod_fcgid`. The `FastCgiIpcDir` and `FastCgiConfig` directives discussed 9 below are `mod_fastcgi` directives; the `DefaultInitEnv` is a `mod_f gcid`16 below are `mod_fastcgi` directives; the `DefaultInitEnv` is a `mod_fcgid` 10 17 directive. 11 18 … … 22 29 LoadModule fastcgi_module /usr/lib/apache2/modules/mod_fastcgi.so 23 30 }}} 24 Setting `FastCgiIpcDir` is optional if the default is suitable. 31 Setting `FastCgiIpcDir` is optional if the default is suitable. Note that the `LoadModule` line must be after the `IfModule` group. 25 32 26 33 Configure `ScriptAlias` or similar options as described in TracCgi, but … … 173 180 # /trac/chrome/common, and use FastCGI for those 174 181 $HTTP["url"] =~ "^/trac(?!/chrome/common)" { 175 # If you have previous fastcgi.server declarations for applications other than Trac, use += here 176 # instead of = so you won't overwrite them 182 # Even if you have other fastcgi.server declarations for applications other than Trac, do NOT use += here 177 183 fastcgi.server = ("/trac" => 178 184 ("trac" => … … 244 250 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. 245 251 252 253 == Simple LiteSpeed Configuration == 254 255 The FastCGI front-end was developed primarily for use with alternative webservers, such as [http://www.litespeedtech.com/ LiteSpeed]. 256 257 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. 258 259 Setup 260 261 1) Please make sure you have first have a working install of a Trac project. Test install with “tracd” first. 262 263 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: 264 265 {{{ 266 http://yourdomain.com/trac/ 267 }}} 268 269 3) Go “TracVhost ? External Apps” tab and create a new “External Application”. 270 271 {{{ 272 Name: MyTracFCGI 273 Address: uds://tmp/lshttpd/mytracfcgi.sock 274 Max Connections: 10 275 Environment: TRAC_ENV=/fullpathto/mytracproject/ <--- path to root folder of trac project 276 Initial Request Timeout (secs): 30 277 Retry Timeout (secs): 0 278 Persistent Connection Yes 279 Connection Keepalive Timeout: 30 280 Response Bufferring: No 281 Auto Start: Yes 282 Command: /usr/share/trac/cgi-bin/trac.fcgi <--- path to trac.fcgi 283 Back Log: 50 284 Instances: 10 285 }}} 286 287 4) Optional. If you need to use htpasswd based authentication. Go to “TracVhost ? Security” tab and create a new security “Realm”. 288 289 {{{ 290 DB Type: Password File 291 Realm Name: MyTracUserDB <--- any name you wish and referenced later 292 User DB Location: /fullpathto/htpasswd <--- path to your htpasswd file 293 }}} 294 295 If 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. 296 297 5) Go to “PythonVhost ? Contexts” and create a new “FCGI Context”. 298 299 {{{ 300 URI: /trac/ <--- URI path to bind to python fcgi app we created 301 Fast CGI App: [VHost Level] MyTractFCGI <--- select the trac fcgi extapp we just created 302 Realm: TracUserDB <--- only if (4) is set. select realm created in (4) 303 }}} 304 305 6) Modify /fullpathto/mytracproject/conf/trac.ini 306 307 {{{ 308 #find/set base_rul, url, and link variables 309 base_url = http://yourdomain.com/trac/ <--- base url to generate correct links to 310 url = http://yourdomain.com/trac/ <--- link of project 311 link = http://yourdomain.com/trac/ <--- link of graphic logo 312 }}} 313 314 7) Restart LiteSpeed, “lswsctrl restart”, and access your new Trac project at: 315 316 {{{ 317 http://yourdomain.com/trac/ 318 }}} 319 246 320 ---- 247 321 See also TracCgi, TracModPython, TracInstall, TracGuide