Edgewall Software

Changes between Version 338 and Version 339 of TracInstall


Ignore:
Timestamp:
Feb 27, 2011, 11:46:04 PM (13 years ago)
Author:
Christian Boos
Comment:

make it really clear that [trac] htdocs_location is only about /chrome/common static resources

Legend:

Unmodified
Added
Removed
Modified
  • TracInstall

    v338 v339  
    275275 - [wiki:TracFastCgi FastCGI]
    276276 - [wiki:TracModWSGI mod_wsgi]
    277  - [wiki:TracModPython mod_python] (no longer recommended, as mod_python is not actively maintained anymore)
    278  - //[wiki:TracCgi CGI]// (should not be used, as the performance is far from optimal)
     277 - //[wiki:TracModPython mod_python] (no longer recommended, as mod_python is not actively maintained anymore)//
     278 - //[wiki:TracCgi CGI] (should not be used, as the performance is far from optimal)//
    279279
    280280Trac also supports [trac:TracOnWindowsIisAjp AJP] which may be your choice if you want to connect to IIS. Other deployment scenarios are possible: [trac:TracNginxRecipe nginx], [http://projects.unbit.it/uwsgi/wiki/Example#Traconapacheinasub-uri uwsgi], etc.
     
    299299Web servers such as [http://httpd.apache.org/ Apache] allow you to create “Aliases” to resources, giving them a virtual URL that doesn't necessarily reflect the layout of the servers file system. We also can map requests for static resources directly to the directory on the file system, avoiding processing these requests by Trac itself.
    300300
    301 There are two primary URL paths for static resources - `/chrome/common` and `/chrome/site`. Plugins can add their own resources usually accessible by `/chrome/plugin` path, so its important to override only known paths and not try to make universal `/chrome` alias for everything.
    302 
    303 Note that in order to get those static resources on the filesystem, you need first to extract the relevant Trac resources using the `deploy` command of TracAdmin:
     301There are two primary URL paths for static resources - `/chrome/common` and `/chrome/site`. Plugins can add their own resources, usually accessible by `/chrome/<plugin>` path, so its important to override only known paths and not try to make universal `/chrome` alias for everything.
     302
     303Note that in order to get those static resources on the filesystem, you need first to extract the relevant resources from Trac using the [TracAdmin trac-admin]` <environment> deploy` command:
    304304[[TracAdminHelp(deploy)]]
    305305
    306 See the `htdocs` directory within the target `<directory>`.
     306The target `<directory>` will then contain an `htdocs` directory with:
     307 - `site/` - a copy of the environment's directory `htdocs/`
     308 - `common/` - the static resources of Trac itself
     309 - `<plugins>/` - one directory for each resource directory managed by the plugins enabled for this environment
    307310
    308311===== Example: Apache and `ScriptAlias` ===== #ScriptAlias-example
     312
     313Assuming the deployment has been done this way:
     314{{{
     315$ trac-admin /var/trac/env deploy /path/to/trac/htdocs/common
     316}}}
    309317
    310318Add 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:
     
    312320Alias /trac/chrome/common /path/to/trac/htdocs/common
    313321Alias /trac/chrome/site /path/to/trac/htdocs/site
     322
    314323<Directory "/path/to/www/trac/htdocs">
    315324  Order allow,deny
     
    325334}}}
    326335
    327 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.
    328 
    329 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` or `WSGIScriptAlias` for the .*cgi scripts, and adjust names and locations to match your installation):
    330 
     336Note that we mapped `/trac` part of the URL to the `trac.*cgi` script, and the path `/trac/chrome/common` is the path you have to append to that location to intercept requests to the static resources.
     337
     338Similarly, if you have static resources in a project's `htdocs` directory (which is referenced by `/trac/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):
    331339{{{
    332340Alias /trac/chrome/site /path/to/projectenv/htdocs
     341
    333342<Directory "/path/to/projectenv/htdocs">
    334343  Order allow,deny
     
    337346}}}
    338347
    339 Alternatively 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:
     348Alternatively to aliasing `/trac/chrome/common`, you can tell Trac to generate direct links for those static resources (and only those), using the [[wiki:TracIni#trac-section| [trac] htdocs_location]] configuration setting:
    340349{{{
    341350[trac]
    342 htdocs_location = http://static.example.org/trac-htdocs
     351htdocs_location = http://static.example.org/trac-common/
    343352}}}
    344353Note 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]).
     
    346355Of 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:
    347356{{{
    348 $ ln -s /path/to/www/trac/htdocs /var/www/yourhost.example.org/trac-htdocs
     357$ ln -s /path/to/trac/htdocs/common /var/www/static.example.org/trac-common
    349358}}}
    350359