2021-11-14 15:52:46 +08:00

1.5 KiB
Raw Permalink Blame History

title, date, lastmod, tags, categories
title date lastmod tags categories
Httpd 笔记 2019-10-30T11:28:36+08:00 2019-10-30T11:28:36+08:00
httpd
web

CentOS7 安装

yum install httpd

支持 SVN

  • 安装 svn 模块
    yum install mod_dav_svn subversion
    
  • 建立 svn 库 test_prj
    mkdir -p /mnt/vdb1/svn_repos/test_prj
    svnadmin create /mnt/vdb1/svn_repos/test_prj
    
  • 编辑 test_prj 下 conf 目录中的 authz 和 passwd 文件,配置权限
  • 启动 svn
    svnserve -d -r /mnt/vdb1/svn_repos/
    #客户端测试
    svn checkout svn://{ip}/test_prj
    
  • 编辑 /etc/httpd/conf.modules.d/10-subversion.conf追加如下
    <Location /test_prj/>
        DAV svn
        SVNListParentPath off
        SVNPath /mnt/vdb1/svn_repos/test_prj/
        #Satisfy Any
        AuthzSVNAccessFile /mnt/vdb1/svn_repos/test_prj/conf/authz
        Require valid-user
    </Location>
    
  • 增加 apache 用户读写 test_prj 目录的权限
    usermod -a -G root apache
    chmod -R g+w /mnt/vdb1/svn_repos/
    
  • 重启 httpd 服务
    systemctl restart httpd
    

Basic HTTP 认证

  • 生成密码文件(用户名是admin密码是123456)
    htpasswd -c -m /etc/httpd/httpd.auth admin # 按提示输入密码
    
  • 在 Location 中配置如下
    <Location />
        AuthType Basic
        AuthName "提示信息"
        AuthUserFile /etc/httpd/httpd.auth
    </Location>