For an Apache server here's the essentials:
1. Copy bin/mod_dav_svn.so and bin/ mod_authz_svn.so to the Apache modules directory.
复制 bin下的mod_dav_svn.so和 mod_authz_svn.so到Apache的 modules目录。
在我的机器上是从C:\svnserver\bin到C:\Apache2.2\modules
2. Add the Subversion/bin directory to the SYSTEM PATH and reboot so all the Subversion
support dll's are visible to the Apache service.
把subversion/bin目录添加到系统的环境变量path中,重启机器。
另外说明:这里可以不用重新启动机器,也可以正常使用,如果有问题的话,可是重启机器看看能不能解决,网上的还有一种解决方法是把这subversion/bin下面的dll文件复制到Apache/bin下,我不推荐这种方式,好像它们有重名的文件具体没有试过。
3. Edit the Apache configuration file (httpd.conf) and make the following changes:
按如下操作修改apache的配置文件,在我的机器上是C:\Apache2.2\conf\httpd.conf.
3a. Uncomment the following two lines:
取消如下两行的注释,即去掉前面的#号。
#LoadModule dav_fs_module modules/mod_dav_fs.so
#LoadModule dav_module modules/mod_dav.so
3b. Add the following two lines to the end of the LoadModule section:
添加下面两行到 LoadModule的结束部分,我添加到了
#LoadModule vhost_alias_module modules/mod_vhost_alias.so和
<IfModule !mpm_netware_module>的中间
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
3c. Add the following to end of the file. Note: This Location directive is a
minimal example with no authentication directives. For other options,
especially authentication options, see the Subversion INSTALL file,
the Subversion Book, or the TortoiseSVN Manual.
把下面这一段复制到文件的结尾部分,就完成了SVN和Apache的集成。但是要把 your/repository/path改成你的资源库位置。这只是一个最小化的配置,在我的机器上,库名是repo,这样你就可以用http://localhost:8090/svn/repo来访问。
<Location /svn>
DAV svn
SVNPath your/repository/path
</Location>
我在我的服务器上设置了多项目和权限控制。和以上安装过程不同的部分也只有在资源库设置的不同,配置如下
<Location /svn>
DAV svn
SVNParentPath C:\SVNREPO #资源库的父目录,因为要设置多个项目
AuthType Basic #验证方式
AuthName "SVN Reop's Authentication" #输入密码时的提示信息
AuthUserFile C:\SVNREPO\svn_passwd_file #用户密码文件
AuthzSVNAccessFile C:\SVNREPO\svn_access_file #用户权限控制文件
Require valid-user #使用密码验证登录
</Location>
svn_passwd_file 在密码文件,svn_access_file是权限控制文件。密码文件使用apache的htpasswd.exe来创建,在此不再多说。
svn_access_file文件的创建,原先我一直以为这个文件应该是UTF-8格式的,可是今天测试了一下,发现并不是这样,它是支持ASCII和UTF-8 without signature,也就是不带BOM(Byte Order Mark)的UTF-8格式。有关BOM参见http://wiki.bmforum.com/BOM。
如果你没有特殊的文件编辑器的话,就只能使用ASCII的,用Windows自带的记事本就可以处理,在这里面最好不要写除ASCII以外的字符。用Em-editor可以创建UTF-8 without signature,它可以支持更多的文字,也许我们用不到。关于这个问题我也不太清楚。但是按这种做法是一定可以的。如果出现403错误,大部分的原因是权限文件不正常,如格式不对,或是文件的编码不正确.
【图403错误】