我正在尝试在CentOS 5.8 (CentOS release 5.8 (最终版))上设置subversion服务器。我只有一点使用CentOS的经验。到目前为止,我只使用过SuSE和Ubuntu。
我遇到的问题是,当我试图通过http://domain.tld/svn访问我的SVN存储库时,我得到“禁止的,您没有权限访问这个服务器上的/svn/”。
以下是我的设置步骤:
yum install mod_dav_svn subversion/etc/httpd/conf.d/subversion.conf的内容
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因此,我还为httpd_sys_rw_content_t添加了2行
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设置了存储库路径。现在一切都好了..。
发布于 2012-07-22 23:45:36
您必须指示Apache执行身份验证(以便Subversion有一个用户可以使用这些规则
在you location中添加类似 to you <Location>指令的内容:
SSLRequireSSL
AuthType Basic
AuthPAM_Enabled on
AuthName "Subversion"
AuthUserFile /etc/shadow
Require valid-user此示例使用PAM,但还有许多其他可能性:请参阅Apache httpd手册
发布于 2012-08-03 02:05:09
试试这个:
<Location /svn>
DAV svn
SVNPath /var/www/svn
</Location>https://stackoverflow.com/questions/11601318
复制相似问题