安装subversion
https://dlcdn.apache.org/subversion/subversion-1.14.3.tar.bz2
./configure --prefix=/opt/svn && make && make install
安装Apache/2.4.57 (Unix)
https://dlcdn.apache.org/httpd/httpd-2.4.58.tar.gz
编译参数:
./configure --prefix=/opt/httpd --enable-so --enable-rewrite --with-included-apr --enable-mods-shared=most --enable-dav --enable-dav-fs
make && make install
apache配置文件httpd.conf:
User svn
Group svn
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
Include conf/extra/httpd-svn.conf
http-svn.conf:
<Location /svn>
DAV svn
SVNParentPath /var/svn
AuthType Basic
AuthName "Please input Username and Password"
AuthUserFile /var/svn/passwd
AuthzSVNAccessFile /var/svn/authz
Require valid-user
</Location>
- SVNParentPath 指定了 SVN 仓库的根目录。
- AuthType, AuthName, AuthUserFile 和 Require 用于配置基本身份验证,确保只有经过身份验证的用户可以访问 SVN 仓库。请替换 SVNParentPath 和 AuthUserFile 为您的 SVN 仓库和密码文件的实际路径。
- 创建密码文件: 使用 htpasswd 工具创建一个用于身份验证的密码文件。例如:
/opt/httpd/bin/htpasswd -c /var/svn/passwd 张云皓
/var/svn/svnserve.conf:
[general]
anon-access = none
auth-access = write
password-db = passwd
authz-db = authz
[sasl]
/var/svn/authz:
[aliases]
[groups]
admins=root
[/]
@admins = rw
[docs:/]
张云皓 = rw
[apps:/]
张云皓 = rw
[videos:/]
张云皓 = rw
创建仓库:
cd /var/svn
/opt/svn/bin/svnadmin create docs
/opt/svn/bin/svnadmin create apps
chown -R svn:svn docs
chown -R svn:svn apps
chown -R svn:svn /var/svn
配置好了以后,重启apache
nginx反向代理ssl:
server {
listen 8121 ssl;
server_name svn.apollo-sun.online;
ssl_certificate config.d/ssl/svn.apollo-sun.online.cer;
ssl_certificate_key config.d/ssl/svn.apollo-sun.online.key;
ssl_session_timeout 5m;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_session_cache shared:SSL1:10m;
location / {
proxy_pass http://127.0.0.1:80;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
}
}
Categories:
系统运维