# Restricting SVN access from virtual servers.



## caesius (Dec 12, 2010)

Hi.

I am hosting a domain on my computer but I also like to access it (my computer) by IP. This is for me only (although I'm not too worried about other people accessing by IP) and I've set things up so that if you use the URL you see one page, and if you use the IP you see another.

Problem is I only want to allow SVN access when the IP is used. I.e.,

http://123.456.789.123/svn/ -> all good, username and password prompt appear
http://mydomain.net.nz/svn -> denied. nothing happens

Here is the relevant portion of my /usr/local/etc/apache22/httpd.conf:


```
NameVirtualHost *:80

<VirtualHost *:80>
    ServerName 123.456.789.123
    DocumentRoot /home/www/default
</VirtualHost>

<VirtualHost *:80>
    ServerName mydomain.net.nz
    ServerAlias www.mydomain.net.nz
    DocumentRoot /home/www/mydomain
</VirtualHost>

<Location /svn>
        DAV svn
        SVNParentPath /usr/home/svn/repos
        SVNIndexXSLT "http://123.456.789.123/svnindex.xsl"
        AuthzSVNAccessFile /usr/home/svn/access/control

        Satisfy Any
        Require valid-user

        AuthType Basic
        AuthName "svn"
        AuthUserFile /home/svn/access/users

</Location>
```

Is it a simple change to make what I want work?

Cheers.


----------



## Alt (Dec 12, 2010)

You can put location directive into virtualhost block


----------

