4

我有一个 VPS,我正在尝试托管几个 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

但是,使用下面的代码,第一件事(欢迎 HTML 页面)没有显示,因为 Location 块优先于 DocumentRoot。

将 Location 块设置为<Location /repos>有效,但随后我的 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>
4

3 回答 3

1

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

于 2009-03-28T17:24:44.067 回答
0

您可以通过为 SVN 存储库添加子域来解决此问题,而无需在每次添加新项目时更改 Apache 配置。你最终会得到这样的东西:

<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>

然后,您必须使用http://svn.domain.com/svn/project1/形式的 URL 访问您的存储库,但是如果您想添加 project4 等,您所要做的就是在 / 下添加新的存储库变量/svn。

于 2009-03-28T20:30:31.187 回答
0

mod_rewrite呢?您可以为非 SVN 内容( http://example.com/info/ )设置一个文件夹,然后使用 mod_rewrite 将对“/”或“/index.php”的请求重定向到“/info/index.php” . 那行得通吗?

于 2009-03-30T08:14:52.857 回答