Svn – Problems configuring SVN with Apache on Ubuntu – 500 Error on commit

apache-2.2mod-dav-svnsvn

I am trying to configure SVN server using DAV on Apache. According to internet resources (for instance https://help.ubuntu.com/10.04/serverguide/subversion.html), installing all those on Ubuntu should be pretty straightforward. And it was, no errors during installation and creation of the first repository, except for the problem during initial import of the project's files (I access the repository via HTTP). What I see in the SVN client (KDESVN) is the following message:

Server sent unexpected return value (500 Internal Server Error) in response to PROPFIND request for 'http://.../svn/myproject/trunk/test.txt'

There is nothing about this error in error.log of Apache and in custom log svn.log I configured in DAV. In access.log there are several lines logging the activity, and this one among them:

{IP} - - [18/Mar/2014:22:47:24 -0300] "PROPFIND /svn/myproject/trunk/test.txt HTTP/1.1" 500 1150 "-" "SVN/1.7.9/SvnQt wrapper client neon/0.29.6" 

with no more details.

My configuration follows.

/etc/apache2/mods-enabled/dav_svn.conf:

<Location /svn>
        DAV svn
        SVNParentPath /var/www/svn-repos
        SVNListParentPath On
        #SVNPathAuthz Off
        AuthType Basic
        AuthName "Subversion Repository"
        AuthUserFile /etc/apache2/passwd
        Require valid-user
        LimitXMLRequestBody 0 
</Location>

CustomLog ${APACHE_LOG_DIR}/svn.log "%t %u %{SVN-ACTION}e" env=SVN-ACTION

Permissions for /var/www/svn-repos:

sudo chmod -R 777 /var/www/svn-repos
sudo chown -R www-data:www-data /var/www/svn-repos

There is one user added to /etc/apache2/passwd which data I use in KDESVN and in command line with --username and --password args.

Versions:

  • Ubuntu 12.04.4 LTS i386
  • Apache/2.2.22
  • SVN 1.6.17 (r1128011)

I was able to create initial repository structure (/trunk, /tags, /branches), commit locally using file:///..., and I'm able to list it in the client or in the browser. But when I do commit from remote machine using http://, the above error arises.

I tried every single solution I could find for this error:

  • Change repository location from /home/svn to /var/www/svn-repos
  • Change repository permissions and ownership (I checked twice, www-data is the Apache's user) – even using the ridiculous 777 didn't help
  • Leave only the portion DAV svn \ SVNParentPath /var/www/svn-repos in the DAV configuration
  • Change loglevel to debug in apache2.conf – I couldn't see more useful info in the logs

Nothing helps. Still the same error.

Is there a way of configuring a better logging, just to see what's this enigmatic 500 Internal Server Error? How to find out what am I missing?

For your suggestions thank you in advance.

Best Answer

Try enabling the rewrite log to verify that you don't have a mod_rewrite rule that is interfering with dav_svn. I ran into a problem with these same symptoms for usvn.

You can enable rewrite logging by (make sure to disable this after you are done debugging):

RewriteLog "/usr/local/var/apache/logs/rewrite.log"
RewriteLogLevel 3

I fixed my problem by adding a line to my .htaccess file to exclude the subdirectory of the dav_svn repositories:

<Files *.ini>
Order Allow,Deny
Deny from all
</Files>

php_flag short_open_tag on
php_flag magic_quotes_gpc off

RewriteEngine on
#RewriteCond
RewriteBase "//usvn/"
RewriteRule ^svn/ - [L,NC] # This is the line I added to exclude this path
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]