| 118 | Conditional configuration is also useful for mapping static resources, i.e. serving out images and CSS directly instead of through FastCGI: |
| 119 | {{{ |
| 120 | # Aliasing functionality is needed |
| 121 | server.modules += ("mod_alias") |
| 122 | |
| 123 | # Setup an alias for the static resources |
| 124 | alias.url = ("/trac/chrome/common" => "/usr/share/trac/htdocs") |
| 125 | |
| 126 | # Use negative lookahead, matching all requests that ask for any resource under /trac, EXCEPT in |
| 127 | # /trac/chrome/common, and use FastCGI for those |
| 128 | $HTTP["url"] =~ "^/trac(?!/chrome/common)" { |
| 129 | # If you have previous fastcgi.server declarations for applications other than Trac, use += here |
| 130 | # instead of = so you won't overwrite them |
| 131 | fastcgi.server = ("/trac" => |
| 132 | ("trac" => |
| 133 | ("socket" => "/tmp/trac-fastcgi.sock", |
| 134 | "bin-path" => "/path/to/cgi-bin/trac.fcgi", |
| 135 | "check-local" => "disable", |
| 136 | "bin-environment" => |
| 137 | ("TRAC_ENV" => "/path/to/projenv") |
| 138 | ) |
| 139 | ) |
| 140 | ) |
| 141 | } |
| 142 | }}} |
| 143 | The technique can be easily adapted for use with multiple projects by creating aliases for each of them, and wrapping the fastcgi.server declarations inside conditional configuration blocks. |
| 144 | |