Edgewall Software

Changes between Version 22 and Version 23 of TracOnGentoo


Ignore:
Timestamp:
Mar 21, 2005, 10:28:13 AM (19 years ago)
Author:
lycos42@…
Comment:

layout

Legend:

Unmodified
Added
Removed
Modified
  • TracOnGentoo

    v22 v23  
    127127Next, there are per-project specific directives that define a project. This example has to be repeated for each project.
    128128{{{
    129         ###
    130         ### project1
    131         ###
    132         Alias /project1/dox /var/www/dev.domain.tld/htdocs/project1/dox
    133 
    134         <Location /project1/svn>
    135                 <IfDefine SVN>
    136                         DAV svn
    137                         SVNPath /var/svn/project1
    138                         SVNIndexXSLT /project1/trac/svnindex.xsl
    139                 </IfDefine>
    140 
    141                 <LimitExcept GET PROPFIND OPTIONS REPORT>
    142                         AuthType Basic
    143                         AuthName "project1::svn"
    144 
    145                         <IfModule mod_auth_ldap.c>
    146                                 AuthLDAPURL ldap://ldap.domain.tld:389/ou=users,dc=domain,dc=tld?uid?one
    147                                 Require group cn=project1,ou=dev,ou=groups,dc=domain,dc=tld
    148                         </IfModule>
    149                 </LimitExcept>
    150         </Location>
    151 
     129###
     130### project1
     131###
     132Alias /project1/dox /var/www/dev.domain.tld/htdocs/project1/dox
     133
     134<Location /project1/svn>
     135      <IfDefine SVN>
     136              DAV svn
     137              SVNPath /var/svn/project1
     138              SVNIndexXSLT /project1/trac/svnindex.xsl
     139      </IfDefine>
     140
     141      <LimitExcept GET PROPFIND OPTIONS REPORT>
     142              AuthType Basic
     143              AuthName "project1::svn"
     144
     145         <IfModule mod_auth_ldap.c>
     146              AuthLDAPURL ldap://ldap.domain.tld:389/ou=users,dc=domain,dc=tld?uid?one
     147              Require group cn=project1,ou=dev,ou=groups,dc=domain,dc=tld
     148         </IfModule>
     149      </LimitExcept>
     150</Location>
     151
     152<Location /project1>
     153         SetEnv TRAC_ENV "/var/lib/trac/project1"
     154</Location>
     155
     156<Location /project1/login>
     157         AuthType Basic
     158         AuthName "project1::trac"
     159
     160       <IfModule mod_auth_ldap.c>
     161            AuthLDAPURL ldap://ldap.domain.tld:389/ou=users,dc=domain,dc=tld?uid?one
     162            Require group cn=project1,ou=dev,ou=groups,dc=domain,dc=tld
     163       </IfModule>
     164</Location>
     165
     166Alias /project1/trac /var/www/dev.domain.tld/htdocs/project1/trac
     167ScriptAlias /project1 /var/www/dev.domain.tld/cgi-bin/trac.cgi
     168}}}
     169As you can see, I make a big use of Locations and Aliases. Now, some comments.
     1704.2.1. Trac stuff
     171
     172We need several directives to make Trac work. The first thing is to set the TRAC_ENV environment variable. This variable indicates to trac.cgi the location of the Trac environment corresponding to project1 in the filesystem. Actually, I'm storing every Trac environment under /var/lib/trac/, so the projectX Trac environment can be found under /var/lib/trac/projectX/.
     173
     174That's why we set the TRAC_ENV for the entire /project1 web space, with the following:
     175{{{
    152176        <Location /project1>
    153177                SetEnv TRAC_ENV "/var/lib/trac/project1"
    154178        </Location>
    155 
    156         <Location /project1/login>
    157                 AuthType Basic
    158                 AuthName "project1::trac"
    159 
    160                 <IfModule mod_auth_ldap.c>
    161                         AuthLDAPURL ldap://ldap.domain.tld:389/ou=users,dc=domain,dc=tld?uid?one
    162                         Require group cn=project1,ou=dev,ou=groups,dc=domain,dc=tld
    163                 </IfModule>
    164         </Location>
    165 
    166         Alias /project1/trac /var/www/dev.domain.tld/htdocs/project1/trac
     179}}}
     180Then we redirect every request for /project1/* to trac.cgi with the ScriptAlias directive:
     181{{{
    167182        ScriptAlias /project1 /var/www/dev.domain.tld/cgi-bin/trac.cgi
    168183}}}
    169 As you can see, I make a big use of Locations and Aliases. Now, some comments.
    170 4.2.1. Trac stuff
    171 
    172 We need several directives to make Trac work. The first thing is to set the TRAC_ENV environment variable. This variable indicates to trac.cgi the location of the Trac environment corresponding to project1 in the filesystem. Actually, I'm storing every Trac environment under /var/lib/trac/, so the projectX Trac environment can be found under /var/lib/trac/projectX/.
    173 
    174 That's why we set the TRAC_ENV for the entire /project1 web space, with the following:
    175 {{{
    176         <Location /project1>
    177                 SetEnv TRAC_ENV "/var/lib/trac/project1"
    178         </Location>
    179 }}}
    180 Then we redirect every request for /project1/* to trac.cgi with the ScriptAlias directive:
    181 {{{
    182         ScriptAlias /project1 /var/www/dev.domain.tld/cgi-bin/trac.cgi
    183 }}}
    184184This needs to be placed at the very end of the project configuration, because it is a default redirection for every request made to /project1/*. Special configuration for some URIs will be placed before this directive to be taken in account.
    185185
    186186A needed escaping URI is /project1/login, used by Trac to authenticate users. I've set a Location for it, and placed the authentication stuff inside:
    187187{{{
    188         <Location /project1/login>
    189                 AuthType Basic
    190                 AuthName "project1::trac"
    191 
    192                 <IfModule mod_auth_ldap.c>
    193                         AuthLDAPURL ldap://ldap.domain.tld:389/ou=users,dc=domain,dc=tld?uid?one
    194 
    195                         Require group cn=project1,ou=dev,ou=groups,dc=domain,dc=tld
    196                 </IfModule>
    197         </Location>
     188<Location /project1/login>
     189       AuthType Basic
     190       AuthName "project1::trac"
     191
     192       <IfModule mod_auth_ldap.c>
     193          AuthLDAPURL ldap://ldap.domain.tld:389/ou=users,dc=domain,dc=tld?uid?one
     194
     195          Require group cn=project1,ou=dev,ou=groups,dc=domain,dc=tld
     196       </IfModule>
     197</Location>
    198198}}}
    199199AuthType, AuthName and Require directives are needed, then you may use the user referential you want (here I'm using a LDAP server). I'm telling Apache that a user may authenticate if he belongs to the project1 group. This way, you can create groups for each project you have, and make users belong to the groups corresponding to the projects they work on.
     
    220220Last but not least, I wanted to make the Subversion repository accessible via /project1/svn, with anonymous checkouts and authenticated commits. We need a Location to place the mod_dav_svn stuff and the authentication directives.
    221221{{{
    222         <Location /project1/svn>
    223                 <IfDefine SVN>
    224                         DAV svn
    225                         SVNPath /var/svn/project1
    226                         SVNIndexXSLT /project1/trac/svnindex.xsl
    227                 </IfDefine>
    228 
    229                 <LimitExcept GET PROPFIND OPTIONS REPORT>
    230                         AuthType Basic
    231                         AuthName "project1::svn"
    232 
    233                         <IfModule mod_auth_ldap.c>
    234                                 AuthLDAPURL ldap://ldap.domain.tld:389/ou=users,dc=domain,dc=tld?uid?one
    235                                 Require group cn=project1,ou=dev,ou=groups,dc=domain,dc=tld
    236                         </IfModule>
    237                 </LimitExcept>
    238         </Location>
     222<Location /project1/svn>
     223       <IfDefine SVN>
     224           DAV svn
     225           SVNPath /var/svn/project1
     226           SVNIndexXSLT /project1/trac/svnindex.xsl
     227       </IfDefine>
     228
     229       <LimitExcept GET PROPFIND OPTIONS REPORT>
     230            AuthType Basic
     231            AuthName "project1::svn"
     232
     233        <IfModule mod_auth_ldap.c>
     234            AuthLDAPURL ldap://ldap.domain.tld:389/ou=users,dc=domain,dc=tld?uid?one
     235            Require group cn=project1,ou=dev,ou=groups,dc=domain,dc=tld
     236        </IfModule>
     237       </LimitExcept>
     238</Location>
    239239}}}
    240240As you can see, I'm storing my Subversion repositories under /var/svn/, so I set the name of the project1 repository to /var/svn/project1. Obviously, it is the filepath I will use when I create the project1 Trac environment.