Hello folks,

I've gotten Trac working with <Location></Location> directives before as
described here:

http://trac.edgewall.org/wiki/TracModPython

However, once I bring Virtual Hosts and forcing SSL (using mod_rewrite) into
the game, I have problems with "the requested URL /trac was not found on
this server".  What I've basically done was set up a bunch of virtual hosts
and then brought the trac <Location> directives inside of the <VirtualHost>
directive.  You'll see that I also use mod_rewrite to rewrite old legacy
trac urls to point to the correct paths which are now project based.  I also
have multiple <Location> directives in my virtual host config, since / goes
to Subversion repo and /trac should go to trac.

I've pasted my vhost config below, and have tried changing several bits of
it - from removing TracEnv, to adding a trailing '/' to /trac, to using
<LocationMatch ~ "/trac">, and etc.  I've also tried commenting out all of
the rewrites and even forcing a ModRewrite Off inside of trac's Location
directive, but with the same result, so I don't *think* the rewrites are
causing a problem, but I could be wrong.  If you have any ideas they would
be greatly appreciated.

Thanks in advance,
-Chris.

So my vhost config for my trac-and-svn vhost looks something like this
(sanitized to protect the innocent):

NameVirtualHost 1.2.3.4:80
<VirtualHost 1.2.3.4:80>
    ServerName dev.mydomain.com
    DocumentRoot /path/to/some/local/dir/html
    <Directory " /path/to/some/local/dir/html">
      Options FollowSymLinks -Indexes
      AllowOverride All
      Order deny,allow
      Allow from all
      Satisfy all
    </Directory>
    RewriteEngine On

    # Redirect any trac/changeset to trac/myproject/changeset to handle any
old URLs
    RewriteRule ^/trac/changeset/(.*) /trac/myproject/changeset/$1 [R]

    # If a request comes in on port 80 it will be redirected to port 443
    RewriteCond %{SERVER_PORT} !^443$
    RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R]

    # Error and access logs.
    ErrorLog /var/log/httpd/error_log
    LogLevel warn
    CustomLog /var/log/httpd/access_log combined

    ServerSignature Off
</VirtualHost>

NameVirtualHost 1.2.3.4:443
<VirtualHost 1.2.3.4:443>
    ServerName dev.mydomain.com
    DocumentRoot /path/to/some/local/dir/html
    SSLEngine               on
    SSLCertificateFile      /path/to/mydomain.crt
    SSLCertificateKeyFile   /path/to/*.mydomain.com.key
    SSLCertificateChainFile /path/to/gd_bundle.crt

    RequestHeader set X_FORWARDED_PROTO 'https'

    RewriteEngine On
    # Redirect any /trac/changeset to /trac/myproject/changeset to handle
any old URLs
    RewriteRule ^/trac/changeset/(.*) /trac/myproject/changeset/$1 [R]

    # Subversion-related Location-based directives
    <Location />
      DAV svn
      SVNPath /svnrepos/myproject/
      SVNReposName MyProject
      AuthType Digest
      AuthName "Company"
      AuthUserFile /path/to/the.htdigest
      Require valid-user
      AuthzSVNAccessFile /path/to/the.authz
    </Location>

    # Trac-related Location-based directives
    <IfModule mod_python.c>
    <Location /trac>
      SetHandler mod_python
      PythonInterpreter main_interpreter
      PythonHandler trac.web.modpython_frontendi
      PythonPath "sys.path + ['/trac']"
      PythonOption TracEnvParentDir /trac
      PythonOption TracEnv /trac/myproject
      PythonOption TracUriRoot /trac
    </Location>

    <LocationMatch "/trac/[^/]+/login">
      AuthType Digest
      AuthName "Shotgun"
      AuthUserFile /path/to/the.htdigest
      Require valid-user
    </LocationMatch>

    ErrorLog /var/log/httpd/error_log
    LogLevel warn
    CustomLog /var/log/httpd/access_log combine
    ServerSignature Off
</VirtualHost>

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en.

Reply via email to