我有一个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页面)显示不出来,因为位置块优先于DocumentRoot的。

设置地点块<Location /repos>作品,但后来我的网址成为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>
有帮助吗?

解决方案

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

其他提示

您可以解决这个问题,而不必通过添加一个子域为你的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的URL来访问你的版本库:// SVN。 domain.com/svn/project1/ ,但如果你想添加project4等所有你需要做的就是在/ var添加新的存储库/ SVN。

关于什么的 mod_rewrite的?你可以建立一个文件夹,用于非SVN的东西( http://example.com/info/ ) ,然后使用mod_rewrite重定向关于“/”或“的index.php”到“/info/index.php”的请求。将这项工作?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top