简体   繁体   English

Nginx反向代理背后的TFS

[英]TFS behind Nginx reverse proxy

Trying to configure Team Foundation Server behind Nginx reverse proxy. 尝试在Nginx反向代理后面配置Team Foundation Server。 Also, I'm using a self-signed SSL Certificate. 另外,我使用的是自签名SSL证书。

Getting ERR_TOO_MANY_REDIRECTS 正在获取ERR_TOO_MANY_REDIRECTS

Here is my nginx configuration: 这是我的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;
}

What I'm doing wrong? 我做错了什么?

Just try to set the proxy_redirect explicitly: 只需尝试显式设置proxy_redirect

eg: 例如:

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

You can reference below article to configure the nginx (It should be similar with TFS): 您可以参考下面的文章来配置nginx(与TFS类似):

How To Configure Nginx with SSL as a Reverse Proxy for Jenkins 如何使用SSL将Nginx配置为Jenkins的反向代理

And this thread may helps: https://serverfault.com/questions/754351/what-is-a-correct-ways-to-allow-login-to-an-iis-site-through-a-reverse-proxy 这个线程可能会有所帮助: https : //serverfault.com/questions/754351/what-is-a-correct-ways-to-allow-login-to-an-iis-site-through-a-reverse-proxy

Besides, you can reference below articles to troubleshoot the ERR_TOO_MANY_REDIRECTS issue: 此外,您可以参考以下文章来解决ERR_TOO_MANY_REDIRECTS问题:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM