---
title: "Httpd 笔记"
date: 2019-10-30T11:28:36+08:00
lastmod: 2019-10-30T11:28:36+08:00
tags: ["httpd"]
categories: ["web"]
---
## CentOS7 安装
```bash
yum install httpd
```
## 支持 SVN
- 安装 svn 模块
```bash
yum install mod_dav_svn subversion
```
- 建立 svn 库 test_prj
```bash
mkdir -p /mnt/vdb1/svn_repos/test_prj
svnadmin create /mnt/vdb1/svn_repos/test_prj
```
- 编辑 test_prj 下 conf 目录中的 authz 和 passwd 文件,配置权限
- 启动 svn
```bash
svnserve -d -r /mnt/vdb1/svn_repos/
#客户端测试
svn checkout svn://{ip}/test_prj
```
- 编辑 /etc/httpd/conf.modules.d/10-subversion.conf,追加如下
```xml
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
```
- 增加 apache 用户读写 test_prj 目录的权限
```bash
usermod -a -G root apache
chmod -R g+w /mnt/vdb1/svn_repos/
```
- 重启 httpd 服务
```bash
systemctl restart httpd
```
## Basic HTTP 认证
- 生成密码文件(用户名是admin,密码是123456)
```bash
htpasswd -c -m /etc/httpd/httpd.auth admin # 按提示输入密码
```
- 在 Location 中配置如下
```xml
AuthType Basic
AuthName "提示信息"
AuthUserFile /etc/httpd/httpd.auth
```