Hi, I have a Virtual machine at xxx.co.uk with Debian Lenny and Apache2. I am trying to install SVN and have been following this guide:

The part where I get stuck is the virtual hosts. I have tried reading loads of guides/posts on this but everybody seems to do it a different way httpd.conf/apache2.cong/sites-enabled. Some say its an issue with DNS some say DNS doesn't matter its all on Pache side. I am just really confused.

Well I have installed SVN and http://example.com/websites as a quick fix inside dav_svn.conf file:

<Location /websites>
	DAV svn
	SVNPath /var/svn/websites

	AuthType Basic
	AuthName "Subversion Repository"
	AuthUserFile /etc/apache2/dav_svn.passwd

	# Required authentication
	Require valid-user

	# Require encryption
	#SSLRequireSSL
</Location>

So I next I create a file in /etc/apache2/sites-available/

NameVirtualHost xxx.co.uk:80
<VirtualHost xxx.co.uk:80>
      ServerAdmin webmaster@xxx.co.uk

      #SSLEngine On
      #SSLCertificateFile /etc/apache2/ssl/apache.pem

      <Location /websites>
        DAV svn
        SVNPath /var/svn/websites

        AuthType Basic
        AuthName "Subversion Repository"
        AuthUserFile /etc/apache2/dav_svn.passwd

        # Required authentication
        Require valid-user

        # Require encryption
        #SSLRequireSSL

      </Location>
      ErrorLog /var/log/apache2/error.log

      LogLevel warn

      CustomLog /var/log/apache2/access.log combined
      ServerSignature On

</VirtualHost>
$ sudo a2ensite svn.example.com

Can anybody shed any light on this? What am I missing? thanks very mcuh for any help people may be able to give.

Dani AI

Generated

Two things are stopping the site from matching the SVN URL: a mismatch between the name-based vhost address and what Apache actually listens on, and where the SVN Location is defined. put NameVirtualHost/<VirtualHost> using a hostname; on Debian/Apache the usual and reliable form is *:80 (and the NameVirtualHost line belongs in ports.conf), and each vhost should include a ServerName that matches the hostname clients use. Use the -S dump to verify how Apache parsed your vhosts. (httpd.apache.org)

Minimal, safe example (place the NameVirtualHost in ports.conf, then enable your site file):

NameVirtualHost *:80     # (in ports.conf)
<VirtualHost *:80>
  ServerName svn.example.com
  # put your SVN Location or Alias here (SVNPath or SVNParentPath)
</VirtualHost>

For Subversion over Apache, enable the DAV modules and use SVNPath (single repo) or SVNParentPath (multiple repos). Do not leave identical <Location> blocks duplicated globally and inside a vhost — either export the repo inside the vhost or export globally, but avoid conflicting/overlapping Location entries. Also ensure the repository filesystem permissions allow the Apache user (typically www-data) to read/write. (svnbook.red-bean.com)

Quick troubleshooting checklist:

  • Confirm Apache config syntax and vhost parsing with apache2ctl -t and apache2ctl -S. (httpd.apache.org)
  • Ensure a2enmod dav dav_svn (and a2enmod authz_svn if used), then reload Apache. (svnbook.red-bean.com)
  • Check /var/log/apache2/error.log for permission/auth errors.
  • For tests without public DNS, follow ’s advice and map the test hostname to the VM IP on the client machine’s hosts file so your ServerName resolves to the server IP.

Following those steps should make Apache select the correct vhost and expose the repository URL at the hostname you intend.

Hi web2works,
For it to work over the internet, the virtual host name should resolve. So, you will need to get the dns fixed.
However, for testing your SVN setup, I would suggest that you update the "/etc/hosts" file in your debian system to point the "hostname" to localhost and verify checkout / commit functionalities. You should be able to create a code repository in the SVN area and then test it out and you should be able to use "" as the hostname when using your SVN.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.