2012-07-22 62 views
1

我打算在CentOS 5.8(CentOS 5.8版(最终版))上安装Subversion服务器。我只有CentOS的一点经验。到目前为止,我只与SuSE和Ubuntu一起工作过。CentOS 5.8上的SVN服务器

我遇到的问题是,当我尝试通过http://domain.tld/svn访问我的SVN存储库时,我得到“Forbidden,您无权访问此服务器上的/ svn /。”。

这些是我的设置步骤:/etc/httpd/conf.d/subversion.conf的

yum install mod_dav_svn subversion 

内容

LoadModule dav_svn_module  modules/mod_dav_svn.so 
LoadModule authz_svn_module modules/mod_authz_svn.so 

<Location /svn> 
    DAV svn 
    SVNParentPath /var/www/svn 
</Location> 

创建相关的路径

mkdir -p /var/www/svn && cd /var/www/svn 
svnadmin create repos 
chown -R apache:apache repos 
service httpd restart 

我不知道,什么是错的...

个在CentOS 5.7的其他来源建议将此作为一个额外的步骤:

chcon -R -t httpd_sys_content_t /var/www/svn/repos 
chcon -R -t httpd_sys_rw_content_t /var/www/svn/repos 

当我执行,我得到chcon: can't apply partial context to unlabeled file /var/www/svn/repos

所以我环顾四周,发现一个用户说,我应该使用

chcon -h system_u:object_r:httpd_sys_content_t /var/www/svn/repos 
chcon -R -h apache:object_r:httpd_sys_content_t /var/www/svn/repos/* 

代替

chcon -R -t httpd_sys_content_t /var/www/svn/repos 

所以我的广告DED还2线httpd_sys_rw_content_t

chcon -h system_u:object_r:httpd_sys_content_t /var/www/svn/repos 
chcon -R -h apache:object_r:httpd_sys_content_t /var/www/svn/repos/* 
chcon -h system_u:object_r:httpd_sys_rw_content_t /var/www/svn/repos 
chcon -R -h apache:object_r:httpd_sys_rw_content_t /var/www/svn/repos/* 

问题仍然存在......

service httpd restart 

问题仍然存在......

编辑

我也开始加入认证规则的subversion.conf:

<LimitExcept GET PROPFIND OPTIONS REPORT> 
    AuthzSVNAccessFile /etc/subversion/svn-access 
    # Require SSL connection for password protection. 
    # SSLRequireSSL 

    AuthType Basic 
    AuthName "Authorization Realm" 
    AuthUserFile /etc/subversion/svn-passwd 
    Require valid-user 
</LimitExcept> 

这些配置规则是从SuSE下的先前正在运行的安装中复制的。这些文件具有有效的内容。问题仍然存在......

编辑

我已删除了<LimitExcept GET PROPFIND OPTIONS REPORT></LimitExcept>线,使认证始终适用。当我现在从浏览器访问svn时,我得到一个HTTP-Basic-Auth窗口。输入现有和正确的凭证后,“禁止”消息再次出现。问题仍然存在...

编辑

我终于得到它运行。我已通过SVNPath /var/www/svn/repos而不是SVNParentPath /var/www/svn设置存储库路径。现在一切都很好...

+0

如果您尝试访问'HTTP会发生什么:\\使用domain.tld \ SVN \ repos'? – madth3 2012-07-22 15:01:20

+0

紫禁城,您没有权限在此服务器上访问/ SVN /回购。 – Ron 2012-07-22 15:14:03

+0

日志文件中的任何内容? – Matteo 2012-07-22 16:03:44

回答

1

你必须指示Apache进行认证(以便颠覆将对用户的规则

使用在你的位置像这种添加的东西<Location>指令:

SSLRequireSSL 

AuthType Basic 
AuthPAM_Enabled on 
AuthName "Subversion" 
AuthUserFile /etc/shadow 
Require valid-user 

这个例子使用PAM,但有很多其他的可能性:参考Apache httpd手册

+0

谢谢你的回答。问题依然存在。我已经编辑我的问题上面... – Ron 2012-07-22 15:57:25

+0

这是不对的,是需要为了得到SVN运行验证。没有验证SVN是公开的,但至少应该运行。因为你是唯一回答的人,所以我将你的回答标记为正确。 – Ron 2012-07-22 18:16:53

0

试试这个:

<Location /svn> 
    DAV svn 
    SVNPath /var/www/svn 
</Location> 
+0

是啊,看我的帖子的最后一行 - 不得不'.../repos'添加到SVNPath'的'结束 – Ron 2012-08-02 20:44:41