如何设置Apache以使用此特定URL配置为SVN服务?

如何设置Apache以使用此特定URL配置为SVN服务?,svn,apache,path,httpd.conf,Svn,Apache,Path,Httpd.conf,我有一个副总裁,我正试图主持几个SVN项目。我希望URL路径如下所示: http://svn.domain.com -> Welcome HTML page (at /var/www/svn.domain.com/httpdocs/index.php) http://svn.domain.com/project1 -> Project 1 SVN Root http://svn.domain.com/project2 -> Project 2 SVN Root http://s

我有一个副总裁,我正试图主持几个SVN项目。我希望URL路径如下所示:

http://svn.domain.com -> Welcome HTML page (at /var/www/svn.domain.com/httpdocs/index.php)
http://svn.domain.com/project1 -> Project 1 SVN Root
http://svn.domain.com/project2 -> Project 2 SVN Root
http://svn.domain.com/project3 -> Project 3 SVN Root
<VirtualHost *>
    ServerName svn.domain.com
    DocumentRoot /var/www/svn.domain.com/httpdocs
    <Location /svn>
            DAV svn
            SVNParentPath /var/svn
            SVNIndexXSLT "/svnindex.xsl"

            AuthzSVNAccessFile /var/svn/access

            SVNListParentPath On
            # try anonymous access first, resort to real
            # authentication if necessary.
            Satisfy Any
            Require valid-user

            # how to authenticate a user
            AuthType Basic
            AuthName "Subversion repository"
            AuthUserFile /var/svn/passwd
    </Location>

    <Directory /var/svn>
    Allow from all </Directory>

    <Directory /var/www/svn.domain.com/httpdocs>
      # Doc. root directives here</Directory>
但是,对于下面的代码,第一件事(欢迎HTML页面)不会显示,因为位置块优先于DocumentRoot

将位置块设置为
有效,但随后我的URL变为
http://svn.domain.com/repos/project1
,我不喜欢

有什么建议吗

<VirtualHost *>
        ServerName svn.domain.com
        DocumentRoot /var/www/svn.domain.com/httpdocs
        <Location />
                DAV svn
                SVNParentPath /var/svn
                SVNIndexXSLT "/svnindex.xsl"

                AuthzSVNAccessFile /var/svn/access

                SVNListParentPath On
                # try anonymous access first, resort to real
                # authentication if necessary.
                Satisfy Any
                Require valid-user

                # how to authenticate a user
                AuthType Basic
                AuthName "Subversion repository"
                AuthUserFile /var/svn/passwd
        </Location>
</VirtualHost>

<Directory /var/svn>
        Allow from all
</Directory>

ServerName svn.domain.com
DocumentRoot/var/www/svn.domain.com/httpdocs
DAV svn
SVNParentPath/var/svn
svnindexlt“/svnindex.xsl”
authzsvnacessfile/var/svn/access
SVNListParentPath打开
#首先尝试匿名访问,求助于real
#必要时进行身份验证。
满足任何
需要有效用户
#如何对用户进行身份验证
AuthType Basic
AuthName“Subversion存储库”
AuthUserFile/var/svn/passwd
通融

您可以使用SVNPATH指令,但是您必须设置三个位置(每个项目都需要自己的位置)

您无需在每次添加新项目时通过为SVN存储库添加子域来更改Apache配置。你会得到这样的结果:

http://svn.domain.com -> Welcome HTML page (at /var/www/svn.domain.com/httpdocs/index.php)
http://svn.domain.com/project1 -> Project 1 SVN Root
http://svn.domain.com/project2 -> Project 2 SVN Root
http://svn.domain.com/project3 -> Project 3 SVN Root
<VirtualHost *>
    ServerName svn.domain.com
    DocumentRoot /var/www/svn.domain.com/httpdocs
    <Location /svn>
            DAV svn
            SVNParentPath /var/svn
            SVNIndexXSLT "/svnindex.xsl"

            AuthzSVNAccessFile /var/svn/access

            SVNListParentPath On
            # try anonymous access first, resort to real
            # authentication if necessary.
            Satisfy Any
            Require valid-user

            # how to authenticate a user
            AuthType Basic
            AuthName "Subversion repository"
            AuthUserFile /var/svn/passwd
    </Location>

    <Directory /var/svn>
    Allow from all </Directory>

    <Directory /var/www/svn.domain.com/httpdocs>
      # Doc. root directives here</Directory>

ServerName svn.domain.com
DocumentRoot/var/www/svn.domain.com/httpdocs
DAV svn
SVNParentPath/var/svn
svnindexlt“/svnindex.xsl”
authzsvnacessfile/var/svn/access
SVNListParentPath打开
#首先尝试匿名访问,求助于real
#必要时进行身份验证。
满足任何
需要有效用户
#如何对用户进行身份验证
AuthType Basic
AuthName“Subversion存储库”
AuthUserFile/var/svn/passwd
通融
#博士。这里的根指令

然后,您必须使用表单的URL访问您的存储库,但是如果您想添加project4等,您所要做的就是在/var/svn下添加新的存储库。

怎么样?您可以为非SVN stuff()设置一个文件夹,然后使用mod_rewrite将“/”或“/index.php”的请求重定向到“/info/index.php”。这行得通吗?

我希望我不必这样做,我只是缺少我的Apache配置诀窍:-/你的意思是“子目录”,而不是子域,这是真的,但这正是我试图避免的:)。谢谢。我相信我尝试过这个解决方案,但失败了。我不知道确切的原因,我很确定它不起作用(tm)。明天我会再进行一次黑客攻击并报告。在DAV下使用一个位置是行不通的,因为一旦启用,就无法在子位置禁用DAV。但是使用mod rewrite重定向到另一个域可以工作
RewriteRule^/info/(.*)$http://someotherhost/info/$1[R]