Edgewall Software

Changes between Version 336 and Version 337 of TracInstall


Ignore:
Timestamp:
Feb 27, 2011, 3:47:22 PM (13 years ago)
Author:
Christian Boos
Comment:

Improve the #ScriptAlias-example

Legend:

Unmodified
Added
Removed
Modified
  • TracInstall

    v336 v337  
    307307
    308308
    309 ===== Example: Apache and `ScriptAlias` =====
    310 
    311 Add the following snippet to Apache configuration ''before'' the `ScriptAlias` or `WsgiScriptAlias` (which maps all the other requests to the Trac application), changing paths to match your deployment:
     309===== Example: Apache and `ScriptAlias` ===== #ScriptAlias-example
     310
     311Add the following snippet to Apache configuration ''before'' the `ScriptAlias` or `WSGIScriptAlias` (which map all the other requests to the Trac application), changing paths to match your deployment:
    312312{{{
    313313Alias /trac/chrome/common /path/to/trac/htdocs/common
     
    326326}}}
    327327
    328 Note that we mapped `/trac` part of the URL to the `trac.cgi` script, and the path `/chrome/common` is the path you have to append to that location to intercept requests to the static resources.
    329 
    330 For example, if Trac is mapped to `/cgi-bin/trac.cgi` on your server, the URL of the Alias should be `/cgi-bin/trac.cgi/chrome/common`, like so:
    331 
    332 {{{
    333 Alias /cgi-bin/trac.cgi/chrome/common /path/to/trac/htdocs/common
    334 }}}
    335 
    336 Similarly, if you have static resources in a project's htdocs directory (which is referenced by /chrome/site URL in themes), you can configure Apache to serve those resources (again, put this '''before''' the `ScriptAlias` for the CGI script, and adjust names and locations to match your installation):
     328Note that we mapped `/trac` part of the URL to the `trac.*cgi` script, and the path `/chrome/common` is the path you have to append to that location to intercept requests to the static resources.
     329
     330Similarly, if you have static resources in a project's `htdocs` directory (which is referenced by /chrome/site URL in themes), you can configure Apache to serve those resources (again, put this ''before'' the `ScriptAlias` or `WSGIScriptAlias` for the .*cgi scripts, and adjust names and locations to match your installation):
    337331
    338332{{{
     
    344338}}}
    345339
    346 Alternatively to hacking `/trac/chrome/site`, you can directly specify path to static resources using `htdocs_location` configuration option in [wiki:TracIni trac.ini]:
     340Alternatively to aliasing `/trac/chrome/common` and `/trac/chrome/site`, you can tell Trac to generate special links for those static resources, using the [[wiki:TracIni#trac-section| [trac] htdocs_location]] configuration setting:
    347341{{{
    348342[trac]
    349 htdocs_location = http://yourhost.example.org/trac-htdocs
    350 }}}
    351 
    352 Trac will then use this URL when embedding static resources into HTML pages. Of course, you still need to make the Trac `htdocs` directory available through the web server at the specified URL, for example by copying (or linking) the directory into the document root of the web server:
     343htdocs_location = http://static.example.org/trac-htdocs
     344}}}
     345Note that this makes it easy to have a dedicated domain serve those static resources (preferentially [http://code.google.com/speed/page-speed/docs/request.html#ServeFromCookielessDomain cookie-less]).
     346
     347Of course, you still need to make the Trac `htdocs/common` directory available through the web server at the specified URL, for example by copying (or linking) the directory into the document root of the web server:
    353348{{{
    354349$ ln -s /path/to/www/trac/htdocs /var/www/yourhost.example.org/trac-htdocs