Edgewall Software

Changes between Version 6 and Version 7 of TracMultipleProjectsWindows


Ignore:
Timestamp:
Jul 8, 2017, 3:34:14 PM (4 months ago)
Author:
Jun Omae
Comment:

using https://httpd.apache.org/docs/ and minor changes

Legend:

Unmodified
Added
Removed
Modified
  • TracMultipleProjectsWindows

    v6 v7  
    11== Global – Microsoft Windows Setup ==
    2 
    32
    43This is the simplest case. With this procedure, you will be able to serve multiple Trac projects, using the same user accounts for every projects (permissions are still per project, but authentication is not). This procedure is based on the original procedure provided by the Trac team and the Initial install instructions at TracOnWindows.
     
    65  Note: *nix based directory references may not work for all settings. Often times a *nix relative or absolute reference needs to be replace with the drive letter and path for it to work in a Windows environment. Often times this can solve problems.
    76
    8   Assumptions:
    9         Default install drive C:[[BR]]
    10         Directories as set in TracOnWindows install guide[[BR]]
    11         Configured not using a Virtual Host directive (am working on instructions for use of Virtual Host)
     7Assumptions:
     8 - Default install drive C:
     9 - Directories as set in TracOnWindows install guide
     10 - Configured not using a Virtual Host directive (am working on instructions for use of Virtual Host)
    1211
    13 Start out by creating a {{{projects}}} directory in your Document Root (C:/Program Files/Apache Group/Apache2/htdocs in this example). Projects will be accessed as http://hostname/projects/projectname. Create a directory in htdocs called, {{{projects}}}. Copy trac.cgi to this {{{projects/}}} directory together with a file named index.html (create if needed). This will be shown when users try to access nonexistent projects.
     12Start out by creating a `projects` directory in your Document Root (`C:/Program Files/Apache Group/Apache2/htdocs` in this example). Projects will be accessed as `http://hostname/projects/projectname`. Create a directory in htdocs called, `projects`. Copy trac.cgi to this `projects/` directory together with a file named index.html (create if needed). This will be shown when users try to access nonexistent projects.
    1413
    15 Next create your Trac projects with trac-admin. In the original *nix multiple repositories install instructions the Trac projects need to reside in the same directory. The reference to the directory is the physical path, In this example we'll use {{{c:/svn/}}} .
     14Next create your Trac projects with trac-admin. In the original *nix multiple repositories install instructions the Trac projects need to reside in the same directory. The reference to the directory is the physical path, In this example we'll use `c:/svn/` .
    1615
    17     Note: if you are following the Trac install your database will be named "something.db" that ".db" is important. Where you set the TRAC_ENV below you will need to add that extension to have it find the database correctly.
     16  Note: if you are following the Trac install your database will be named `something.db` that `.db` is important. Where you set the `TRAC_ENV` below you will need to add that extension to have it find the database correctly.
    1817
    19 Add the following to your Apache configuration: 
     18Add the following to your Apache configuration:
    2019
    2120{{{
     
    3130# RewriteLog "C:/Program Files/Apache Group/Apache2/logs/rewrite.log"
    3231RewriteRule ^/projects/+$                       /projects/index.html [L]
    33 #RewriteCond /var/lib/trac/$1                   -d   
     32#RewriteCond /var/lib/trac/$1                   -d
    3433# following rule check TRAC_ENV, after $1 you may need to add '.db' if based on Trac install
    3534RewriteRule ^/projects/([[:alnum:]]+)(/?.*)     /projects/trac.cgi$2 [S=1,E=TRAC_ENV:c:/svn/$1]
     
    5453        Require valid-user
    5554</LocationMatch>
    56 }}} 
     55}}}
    5756
    5857Now, when you add another project, you don't need to edit any apache config. The only file you may want to edit is index.html to make it list the new project. If you think this is too much work, replace it with a python cgi script that does it for you.
     
    6059[wiki:TracStandalone tracd] and TracModPython can also serve multiple projects.
    6160
    62 '''Suggestion:''' In the second ''RewriteRule'' directive and in the ''LocationMatch'' directive, change {{{[[:alnum:]]}}} to {{{[^/]}}} because while {{{[[:alnum:]]}}} only matches an alpha-numeric character, {{{[^/]}}} matches any character that is not a slash.  This change allows for, among other things, hyphens in project/directory names.  Another possibility is to replace {{{[[:alnum:]]}}} with {{{[[:alnum:]\-]}}}, which matches only an alphanumeric character or a hyphen (the backslash "escapes" the hyphen, which would otherwise have special meaning).  The [http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html Apache 2.0 mod_rewrite documentation] suggests referencing the Perl regular expression manual page (run {{{perldoc perlre}}} on a system where Perl is installed) for details on regular expressions.  Note that it may be preferable to use a pattern that matches only characters suitable for directory names (and, thus, project names) that are valid for your particular installation.
    63 
     61'''Suggestion:''' In the second `RewriteRule` directive and in the `LocationMatch` directive, change `[[:alnum:]]` to `[^/]` because while `[[:alnum:]]` only matches an alpha-numeric character, `[^/]` matches any character that is not a slash.  This change allows for, among other things, hyphens in project/directory names.  Another possibility is to replace `[[:alnum:]]` with `[[:alnum:]\-]`, which matches only an alphanumeric character or a hyphen (the backslash "escapes" the hyphen, which would otherwise have special meaning). The [https://httpd.apache.org/docs/2.0/mod/mod_rewrite.html Apache 2.0 mod_rewrite documentation] suggests referencing the Perl regular expression manual page (run `perldoc perlre` on a system where Perl is installed) for details on regular expressions.  Note that it may be preferable to use a pattern that matches only characters suitable for directory names (and, thus, project names) that are valid for your particular installation.