Is this possible? I had troubles with SVN clients not being able to access the repository with the following error message:
Repository moved permanently to 'http://svn.example.com/test/'; please relocate
If I added the '/' to the end of the path I was trying to access, it just strips it off again, and shows the same error message. My configuration file looks like:
<VirtualHost *>
ServerName svn.example.com
# Normal VirtualHost stuff here
<Location /svn>
# Uncomment this to enable the repository
DAV svn
SVNParentPath /some/path/to/repositories
# Setup mod_authz_svn, etc, etc here
</Location>
</VirtualHost>
Note: This works. But if I change the Location to just /
it stops working again with the error above. Is it possible to use the root directory, or am I missing something here? Firefox displays the repository listing fine when serving the repositories out of the root.
As someone else pointed out, this only seems to be an issue inside named virtual hosts... Anyone have any smart ideas why?
The problem is that you are using the document root also as the repository root (I'm not blaming you, this should just work, but it doesn't).
Try pointing the DocumentRoot
and SVNParentPath
directives to different physical locations, so the resulting config file should look like this (abbreviated):
<VirtualHost *:80>
DocumentRoot /home/svn.example.com/docroot
<Location />
SVNParentPath /home/svn.example.com/svnroot
SVNListParentPath on
</Location>
</VirtualHost>
Also, as @Nigel Jewell says, remove that Rewrite block, for sanity.
Continuing from comments to my previous answer, I've tried also with a VirtualHost:
<VirtualHost 127.0.0.1:80>
<Location />
DAV svn
SVNPath /repository
AuthType Basic
AuthName "Repository authentication"
AuthUserFile /repository/.svn-auth
AuthzSVNAccessFile /repository/.svn-access
Satisfy All
Require valid-user
</Location>
</VirtualHost>
and it's working, I can browse the repository with firefox and can access it with the svn command line client.
Found this in /etc/apache2/conf.d/subversion.conf (need to map error documents to defaults):
<VirtualHost *>
ServerName svn.example.com
ErrorLog /var/log/apache2/svn.example.com-error_log
TransferLog /var/log/apache2/svn.example.com-access_log
#
# Do not set DocumentRoot. It is not needed here and just causes trouble.
#
# Map the error documents back to their defaults.
# Otherwise mod_dav_svn tries to find a "error" repository.
#
ErrorDocument 400 default
ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 405 default
ErrorDocument 408 default
ErrorDocument 410 default
ErrorDocument 411 default
ErrorDocument 412 default
ErrorDocument 413 default
ErrorDocument 414 default
ErrorDocument 415 default
ErrorDocument 500 default
ErrorDocument 501 default
ErrorDocument 502 default
ErrorDocument 503 default
#
<Location />
...
</Location>
After I've done this everything started working as expected.
I ended up using mod_rewrite succesfully to rewrite all access to the root directory into /svn
, hence getting access to the repositories from /repository_name
. For reference, this is the configuration I ended up with:
# Rewrite / into /svn to avoid errors that seem to occur when using the root
# for repositories.
RewriteEngine On
# Subdirectories that SHOULD be accessed directly, ie. trac
# /svn should be here to avoid redirect loops
RewriteCond %{REQUEST_URI} !^/(trac|svn)/
RewriteRule ^/(.*)$ /svn/$1 [PT]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With