星期二, 二月 27, 2007

svn over http

sh$ cat /usr/src/apache/.config
command = "./configure --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr --with-mpm=prefork --enable-so --enable-rewrite=static --enable-track-vars --enable-dav=shared --enable-dav-fs=shared --enable-dav-lock=shared";

sh$ cat /usr/src/subversion/.config
command = "./configure --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr";
command = "make";
command = "sed -i 's@MKDIR = /usr/bin/install -c -d@MKDIR = mkdir -p@g' Makefile";
command = "make install";

sh$ cat httpd.conf
......
NameVirtualHost *:80

"<"VirtualHost *:80">"
ServerName docs.shopex.cn
DocumentRoot "/var/www/html/docs"
"<"Directory "/var/www/html/docs"">"
Options Indexes FollowSymLinks
AllowOverride None

Order allow,deny
Allow from all
"<"/Directory">"
"<"Location /repos">"
DAV svn
SVNParentPath /var/www/html/docs/repos
"<"/Location">"
"<"/VirtualHost">"

sh$ svnadmin create --fs-type fsfs http://docs.shopex.cn/
svnadmin: 'http://docs.shopex.cn' is an URL when it should be a path
svnadmin 直接访问版本库(因此只可以在存放版本库的机器上使用),它通过路径访问版本库,而不是 URL。
sh$ svnadmin create --fs-type fsfs /var/www/html/docs/repos/sysadm

sh$ svn list http://docs.shopex.cn/docs
svn: Unrecognized URL scheme for 'http://docs.shopex.cn/docs'

这是因为没有 ra_dav 这个库。
sh$ upm files subversion-1.4.3 | grep ra_dav

故障解决
但是编译没有成功将 ra_dav 编译进来,这是因为 neon 不存在或版本不够。可以从 ./configure 的输出中找到相应的说明。

sh$ rpm -qi neon
neon is an HTTP and WebDAV client library, with a C interface;
providing a high-level interface to HTTP and WebDAV methods along
with a low-level interface for HTTP request handling. neon
supports persistent connections, proxy servers, basic, digest and
Kerberos authentication, and has complete SSL support.


换用一个较低版本的 subversion,保证可以成功编译 ra_dav,然后运行:
sh$ svn list file:///var/www/html/docs/repos/sysadm/
sh$ svn list http://docs.shopex.cn/repos/sysadm
svn: PROPFIND request failed on '/repos/sysadm'
svn: PROPFIND of '/repos/sysadm': 301 Moved Permanently (http://docs.shopex.cn)
从页面上访问 docs.shopex.cn/repos:
Forbidden
You don't have permission to access /repos/ on this server. 然后访问 http://docs.shopex.cn/repos/index.html:
"<"D:error">"
"<"C:error/">"
"<"m:human-readable errcode="2"">"
Could not open the requested SVN filesystem
"<"/m:human-readable">"
"<"/D:error">"
这个问题参考这些页面:
Subversion 出現 301 Moved Permanently 的解決方法
subversion 301-error
SVN 基本的 Apache 配置
也就是说,不能将 DocumentRoot 和 SVN 的 repos Location 定义为同样的路径,因为如果一个请求的 URI 是/repos/foo.py,Apache不知道是直接到 repos/foo.py 访问这个文件还是让 mod_dav_svn 代理从 Subversion 版本库返回 foo.py。这里只需要注释上面的 DocumentRoot 即可!

没有评论: