SVN 配置 http(s) 访问

相关链接:

在CentOS 7 1804 中 安装 Apache HTTP Server 并 配置 腾讯云 SSL

在CentOS 7 1804 中 安装 Apache HTTP Server 并 配置 阿里云 SSL

在CentOS 7 1804 中 配置 Apache HTTP Server 将 http 自动跳转之 https

在CentOS 1804 中安装 Subversion(SVN)

在CentOS 1804中设置Subversion(SVN)开机自启


  1. 前提:
    1. 配置httpd请阅读本文前后的相关链接。
    2. 配置httpd的ssl请阅读本文前后的相关链接。
    3. 配置httpd的http自动跳转https请阅读本文前后的相关链接。
    4. 配置svn请阅读本文前后的相关链接。
  2. 查看httpd版本:
    [root@CentOS-x86-64-DVD-1804-Desktop ~]# httpd -version
    Server version: Apache/2.4.6 (CentOS)
    Server built:   Jun 27 2018 13:48:59
    
  3. 查看svn版本:
    [root@CentOS-x86-64-DVD-1804-Desktop ~]# svnserve --version
    svnserve, version 1.7.14 (r1542130)
       compiled Apr 11 2018, 02:40:28
    
    Copyright (C) 2013 The Apache Software Foundation.
    This software consists of contributions made by many people; see the NOTICE
    file for more information.
    Subversion is open source software, see http://subversion.apache.org/
    
    The following repository back-end (FS) modules are available:
    
    * fs_base : Module for working with a Berkeley DB repository.
    * fs_fs : Module for working with a plain file (FSFS) repository.
    
    Cyrus SASL authentication is available.
    
  4. 安装mod_dav_svn:
    [root@CentOS-x86-64-DVD-1804-Desktop ~]# yum -y install mod_dav_svn
  5. 创建密码:
    第一次使用(有 - c):
    [root@CentOS-x86-64-DVD-1804-Desktop conf]# htpasswd -c -m passwd.htpasswd xuxiaowei
    New password: 
    Re-type new password: 
    Adding password for user xuxiaowei
    添加用户使用(无 - c):
    [root@CentOS-x86-64-DVD-1804-Desktop conf]# htpasswd -m passwd.htpasswd xuxiaowei2
    New password: 
    Re-type new password: 
    Adding password for user xuxiaowei2
    
    更新用户密码使用(无 - c):
    [root@CentOS-x86-64-DVD-1804-Desktop conf]# htpasswd -m passwd.htpasswd xuxiaowei
    New password: 
    Re-type new password: 
    Updating password for user xuxiaowei
  6. 创建/etc/httpd/conf.d/subversion.conf文件(文件名无所谓,后缀名必须为.conf,/etc/httpd/conf/httpd.conf会读取/etc/httpd/conf.d/*.conf文件),并新增如下内容:
    <Location /CSDN>
            DAV svn
    
            # SVNPath 单SVN目录
            # SVNParentPath SVN公共父目录
            SVNPath /data/svn/CSDN
    
            # 使用SVNParentPath需要激活SVNListParentPath
            SVNListParentPath on
    
            # 身份验证的类型
            AuthType Basic
    
            # 是您为身份验证域选择的任意名称。 
            # 提示输入用户名和密码时,大多数浏览器会在对话框中显示此名称。
            AuthName "Authorization SVN"
    
            # 权限策略 使用svn默认策略
            AuthzSVNAccessFile /data/svn/CSDN/conf/authz
    
            # 指定要使用的密码文件的位置 不适用原SVN密码本
            AuthUserFile /data/svn/CSDN/conf/passwd.htpasswd
    
            Require valid-user
    </Location>
    
    上述subversion.conf为单SVN配置说明,多SVN配置说明在注释中,多SVN注释说明中的权限策略要使用通配设置。
  7. 重启httpd:
    [root@CentOS-x86-64-DVD-1804-Desktop conf.d]# systemctl restart httpd.service 
    
  8. svn的http(s)浏览器访问如图所示:
  9. svn的http(s) TortoiseSVN 访问如图所示:
  10. 特别说明:
    1. 权限策略:svn协议和http(s)协议使用的相同,都是/data/svn/CSDN/conf/authz
    2. 用户认证:
      1. svn协议使用的是原始svn密码认证方式。
      2. http(s)协议使用的是htpasswd密码认证方式。

猜你喜欢

转载自blog.csdn.net/qq_32596527/article/details/83096949