我已经在 stackoverflow 上问过这个问题,但它可能更适合 serverfault......
我在 Nginx 代理后面使用 SSL 运行 Apache + Subversion 时遇到问题,我希望有人能解答。我在 Google 上搜索了几个小时,寻找问题的答案,但似乎无法找到答案。当我尝试使用 subversion 进行 MOVE 或 COPY 时,我看到的是“502(网关错误)”错误;但是,签出和提交工作正常。以下是相关 nginx 和 apache 配置文件的相关部分(我认为):
Nginx
upstream subversion_hosts {
server 127.0.0.1:80;
}
server {
listen x.x.x.x:80;
server_name hostname;
access_log /srv/log/nginx/http.access_log main;
error_log /srv/log/nginx/http.error_log info;
# redirect all requests to https
rewrite ^/(.*)$ https://hostname/$1 redirect;
}
# HTTPS server
server {
listen x.x.x.x:443;
server_name hostname;
passenger_enabled on;
root /path/to/rails/root;
access_log /srv/log/nginx/ssl.access_log main;
error_log /srv/log/nginx/ssl.error_log info;
ssl on;
ssl_certificate server.crt;
ssl_certificate_key server.key;
add_header Front-End-Https on;
location /svn {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
set $fixed_destination $http_destination;
if ( $http_destination ~* ^https(.*)$ )
{
set $fixed_destination http$1;
}
proxy_set_header Destination $fixed_destination;
proxy_pass http://subversion_hosts;
}
}
阿帕奇
Listen 127.0.0.1:80
<VirtualHost *:80>
# in order to support COPY and MOVE, etc - over https (443),
# ServerName _must_ be the same as the nginx servername
# http://trac.edgewall.org/wiki/TracNginxRecipe
ServerName hostname
UseCanonicalName on
<Location /svn>
DAV svn
SVNParentPath "/srv/svn"
Order deny,allow
Deny from all
Satisfy any
# Some config omitted ...
</Location>
ErrorLog /var/log/apache2/subversion_error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/subversion_access.log combined
</VirtualHost>
从我研究这个问题时了解到的情况来看,服务器名称必须在 apache 服务器和 nginx 服务器上匹配,我已经做到了。此外,即使我将配置更改为仅使用 http,这个问题似乎仍然存在。