
我嘗試在 apache 伺服器上設定 subversion。我遵循了這個指南:[http://wiki.centos.org/HowTos/Subversion][1]
如果我隨後嘗試使用 Tortoise SVN 簽出一個項目,我會收到以下錯誤:
Unexpected HTTP status 405 'Method Not Allowed' on '/repos
如果我嘗試在 linux 伺服器本身上使用 svn 用戶端,我會收到以下錯誤:
svn: Server sent unexpected return value (405 Method Not Allowed) in response to OPTIONS request for 'https://server.ch/repos'
我目前在 apache 伺服器上的配置如下所示:
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
<VirtualHost *:443>
...
<Directory "/var/www/svn/">
Order allow,deny
Allow from all
AllowOverride all
AuthType Basic
AuthName "Authorization Realm"
AuthUserFile /etc/subversion/svn-auth-conf
Require valid-user
</Directory>
<Location /repos>
DAV svn
SVNParentPath /var/www/svn/repos
SVNListParentPath on
SSLRequireSSL
AuthType Basic
AuthName "Authorization Realm"
AuthUserFile /etc/subversion/svn-auth-conf
Require valid-user
</Location>
</VirtualHost>
感謝您提前提供任何建議或協助
問候馬克
答案1
我發現問題是,Location 和 SVNParentPath 設定錯誤。我按照這裡的解決方案[http://www.wandisco.com/svnforum/threads/35525-Stuck-with-error-%E2%80%9C405-Method-Not-Allowed%E2%80%9D][1]
apache 上的正確配置如下圖所示:
<VirtualHost *:443>
...
<Location /svn>
DAV svn
SVNParentPath /var/www/svn
SVNListParentPath on
SSLRequireSSL
AuthType Basic
AuthName "Authorization Realm"
AuthUserFile /etc/subversion/svn-auth-conf
Require valid-user
</Location>
</VirtualHost>
答案2
在 Apache 設定中的某個位置停用OPTIONS
SVN 使用的此方法。您可以在內部啟用此方法<Directory "/var/www/svn/">
<Directory "/var/www/svn/">
...other config here
<Limit OPTIONS>
Order Deny,Allow
Allow from all
</Limit>
...other config here
</Directory>
您必須知道啟用此方法的安全性意義。 SVN所使用的所有HTTP方法,請參考官方文檔。