TFS落后于Nginx反向代理

时间:2018-03-21 12:18:44

标签: nginx tfs ssl-certificate reverse-proxy

尝试在Nginx反向代理后面配置Team Foundation Server。 另外,我使用的是自签名SSL证书。

获取ERR_TOO_MANY_REDIRECTS

这是我的nginx配置:

server {
    listen 80 default;
    server_name tfs.domain.com;
    return 301 https://$host$request_uri;    
}

upstream tfs.domain.com {
        server 12.34.56.78:80; #local tfs address
        keepalive 16;
}

server {
    listen 443 ssl;
    server_name tfs.domain.com;

    ssl_certificate /etc/nginx/ssl/tfs.domain.com.pem;
    ssl_certificate_key /etc/nginx/ssl/tfs.domain.com.key;
    ssl_session_cache shared:SSL:10m;

    ssl_session_timeout 5m;

    ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
    ssl_prefer_server_ciphers on;

    location / {
        proxy_pass http://12.34.56.78:80; #local tfs address
        proxy_http_version 1.1;
        proxy_set_header Connection "";
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
        proxy_redirect http:// $scheme://;

    }
    access_log /var/log/nginx/tfs.domain.com/443-access.log;
    error_log /var/log/nginx/tfs.domain.com/443-error.log;
}

我做错了什么?

1 个答案:

答案 0 :(得分:1)

尝试明确设置proxy_redirect

例如:

proxy_redirect  http://localhost:8080 https://tfs.domain.com;

您可以参考下面的文章来配置nginx(它应该与TFS类似):

How To Configure Nginx with SSL as a Reverse Proxy for Jenkins

这个帖子可能会有所帮助:https://serverfault.com/questions/754351/what-is-a-correct-ways-to-allow-login-to-an-iis-site-through-a-reverse-proxy

此外,您可以参考以下文章来解决ERR_TOO_MANY_REDIRECTS问题: