Changes between Version 1 and Version 2 of TracCgi


Ignore:
Timestamp:
Jun 28, 2008, 4:46:29 AM (14 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TracCgi

    v1 v2  
    3333}}}
    3434
    35  ''Note that the `SetEnv` directive requires the `mod_env` module to be installed and enable.''
     35 ''Note that the `SetEnv` directive requires the `mod_env` module to be installed and enable. If not, you could set TRAC_ENV in trac.cgi. Just add the following code between "try:" and "from trac.web ...":''
     36
     37{{{
     38    import os
     39    os.environ['TRAC_ENV'] = "/path/to/projectenv"
     40}}}
     41
     42 '' Or for TRAC_ENV_PARENT_DIR: ''
     43
     44{{{
     45    import os
     46    os.environ['TRAC_ENV_PARENT_DIR'] = "/path/to/project/parent/dir"
     47}}}
    3648
    3749This will make Trac available at `http://yourhost.example.org/trac`.
     
    6072For 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`.
    6173
     74Similarly, if you have static resources in a projects htdocs directory, 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):
     75
     76{{{
     77Alias /trac/chrome/site /path/to/projectenv/htdocs
     78<Directory "/path/to/projectenv/htdocs">
     79  Order allow,deny
     80  Allow from all
     81</Directory>
     82}}}
     83
    6284Alternatively, you can set the `htdocs_location` configuration option in [wiki:TracIni trac.ini]:
    6385{{{
     
    7092$ ln -s /usr/share/trac/htdocs /var/www/your_site.com/htdocs/trac-htdocs
    7193}}}
     94
     95Note that in order to get this `htdocs` directory, you need first to extract the relevant Trac resources using the `copystatic` command of TracAdmin:
     96[[TracAdminHelp(copystatic)]]
     97
    7298
    7399== Adding Authentication ==
     
    113139}}}
    114140
    115 For better security, it is recommended that you either enable SSL or at least use the “Digest” authentication scheme instead of “Basic”. Please read the [http://httpd.apache.org/docs/2.0/ Apache HTTPD documentation] to find out more.
     141For better security, it is recommended that you either enable SSL or at least use the “Digest” authentication scheme instead of “Basic”. Please read the [http://httpd.apache.org/docs/2.0/ Apache HTTPD documentation] to find out more. For example, on a Debian 4.0r1 (etch) system the relevant section  in apache configuration can look like this:
     142{{{
     143<Location "/trac/login">
     144    LoadModule auth_digest_module /usr/lib/apache2/modules/mod_auth_digest.so
     145    AuthType Digest
     146    AuthName "trac"
     147    AuthDigestDomain /trac
     148    AuthDigestFile /somewhere/trac.htpasswd
     149    Require valid-user
     150</Location>
     151}}}
     152and you'll have to create your .htpasswd file with htdigest instead of htpasswd as follows:
     153{{{
     154# htdigest /somewhere/trac.htpasswd trac admin
     155}}}
     156where the "trac" parameter above is the same as !AuthName above  ("Realm" in apache-docs).
    116157
    117158----