Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have an issue with my Apache config, specifically how it interacts with the SVN DAV mod.

What I want to be able to do is have domain.com point at my website, svn.domain.com to point at my svn directory (which is currently outside of my public_html directory) and for both to be accessible via https.

I've got it working for the most part, but if I set up an explicit VirtualHost for the svn subdomain, it stops the svn application from being able to access the repositories (instead just getting a "repository moved permanently" error), I can browse the repos ok.

my config looks something like:

<VirtualHost *:443>
    ServerName domain.com
    ServerAlias www.domain.com svn.domain.com
    DocumentRoot /path/to/website/dir
    ...
    #stuff for SSL cert etc.
</VirtualHost>

<VirtualHost *:80>
    ServerName domain.com
    ServerAlias www.domain.com
    DocumentRoot /path/to/website/dir
    ...
</VirtualHost>

<Location /repo>
    DAV svn
    SVNPath /path/to/repos
    ... #auth details
</Location>

This works mostly, but browsing to svn.domain.com brings up my website, and browsing to domain.com/repo brings up the repository (svn.domain.com/repo works fine, domain.com also works fine), potentially I'd maybe want domain.com/repo to display a set of webpages all about my project, docs etc, svn.domain.com would ideally point to either nothing, or a list of the repositories available or a separate page or something. I thought I'd got the hang of apache config files, but this one is stumping me!

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

You should have a separate <VirtualHost> directive for your svn.domain.com and domain.com / www.domain.com domains. It looks like you're trying to squeeze both in to the first <VirtualHost>. After you have them separated, put the SVN directives inside the svn.domain.com host.

share|improve this answer
    
I tried this at first but when svn.domain.com has its own virtual host, running the svn command on remote boxes fails, complaining that it has "moved permanently" and can't interact with the repository at all. Browsing the repository via a web browser works fine though! The error I get is svn: Repository moved permanently to 'https://svn.domain.com/repos/'; please relocate –  MalphasWats Jan 15 '10 at 18:46
    
Got it! I had another go at splitting it out, this time leaving out the DocumentRoot directive from the svn virtualhost, figuring that I don't actually want apache trying to serve any documents, SVN needs to do it. Everything works as I want, with the single exception that I can't get svn.domain.com to display a webpage, I just get Forbidden, svn.domain.com/repos displays the repos fine, domain.com/repo give me the 404 error I expect. Thank you –  MalphasWats Jan 15 '10 at 19:17
    
That's probably because the checkout you have still points to the old http:// address. You need to use svn switch --relocate on your working copy to update the address. –  Kamil Kisiel Jan 15 '10 at 19:18
    
I had been getting the error even when doing an svn info https://svn.domain.com/repos, I have the repos accessible via both http and https at the moment –  MalphasWats Jan 15 '10 at 19:22
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.