我试图在我们新的公司服务器上build立一个SVN仓库。 我们使用nginx的SSL终止和Apache作为SVN的后端。
我不知道什么是我的configuration错误,但如果我打电话给svn info https://svn.example.com/repo我得到:
Redirecting to URL 'https://svn.example.com/repo': Redirecting to URL 'https://svn.example.com/repo': svn: E195019: Redirect cycle detected for URL 'https://svn.example.com/repo'
如果我使用wireshark从nginx前端嗅探未encryption的stream量到我们的apache后端,我可以看到“/ repo”的“Options”请求,然后是301 Moved Permanentlyredirect到http://svn.example.com/repo/ 。 但svn客户端显然只看到一个redirect到https://svn.example.com/repo (尾随斜线由nginx剥离),它只是为了得到这个redirect
我想我的错误是一些简单的configuration指令,我忘了设置或类似的东西,但经过超过3个小时的search,没有find任何有用的东西,我感到有点无奈。
我的nginxconfiguration:
server { ssl on; ssl_certificate ssl/svn.example.com.crt; ssl_certificate_key ssl/svn.example.com.key; listen 1.2.3.4:443 ssl spdy; allow all; server_name svn.example.com; location / { set $fixed_destination $http_destination; if ( $http_destination ~* ^https(.*)$ ) { set $fixed_destination http$1; } proxy_set_header Destination $fixed_destination; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-By $server_addr:$server_port; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://127.0.0.1:8080; proxy_redirect http:// https://; } }
这是Apache虚拟主机configuration:
<VirtualHost *:8080> ServerName svn.example.com ServerAdmin [email protected] DocumentRoot /srv/svn <Directory /srv/svn> Options none AllowOverride None Order deny,allow Deny from all </Directory> <Location /> Order deny,allow Allow from all DAV svn SVNParentPath /srv/svn SVNReposName "Subversion Repository" #our access control policy AuthzSVNAccessFile /srv/svn/access #only authenticated users may access the repository Require valid-user #how to authenticate a user AuthType Basic AuthName "Subversion Repository" AuthUserFile /srv/svn/users Satisfy All </Location> ErrorLog ${APACHE_LOG_DIR}/svn_error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog ${APACHE_LOG_DIR}/svn_access.log combined </VirtualHost>
我的软件版本:
# apache2ctl -v Server version: Apache/2.2.22 (Debian) Server built: Feb 1 2014 21:26:04 # nginx -v nginx version: nginx/1.6.0 #svn --version svn, version 1.8.9 (r1591380) compiled May 21 2014, 03:09:46 on x86_64-pc-linux-gnu Copyright (C) 2014 The Apache Software Foundation. This software consists of contributions made by many people; see the NOTICE file for more information. Subversion is open source software, see http://subversion.apache.org/ The following repository access (RA) modules are available: * ra_svn : Module for accessing a repository using the svn network protocol. - with Cyrus SASL authentication - handles 'svn' scheme * ra_local : Module for accessing a repository on local disk. - handles 'file' scheme * ra_serf : Module for accessing a repository via WebDAV protocol using serf. - using serf 1.3.6 - handles 'http' scheme - handles 'https' scheme
在客户端上有相同的svn版本。
那么,谷歌search之后,我终于find了解决scheme: https : //stackoverflow.com/questions/18474825/what-is-the-cause-of-svn-e195019-redirect-cycle-detected-for-url/18474826# 18474826
将DocumentRoot移动到“svn root”之外的其他位置之后,所有事情都按预期工作。
我希望这可以帮助有同样问题的人。