【问题标题】:Nginx as Exchange-proxyNginx 作为 Exchange 代理
【发布时间】:2016-05-24 21:07:37
【问题描述】:

我已经为此寻找解决方案好几个小时了。我对 Nginx 也很陌生,所以如果有人可以帮助我进行演示配置,那就太好了。

  • 1 个公共 IP 地址(这是造成这么多麻烦的原因)
  • Nginx 作为代理
  • 2013 年交流

目前情况:

  • http:apps.domain.org、video.domain.org、geo.domain.org。 80 端口上的流量流向 Nginx 服务器。
  • https:mail.domain.org。端口 443 上的流量直接流向 Exchange 2013。

现在,我们的 apps.domain.org 上需要 https / SSL。 我们的防火墙仅检查 IP 地址并转发流量。

所以基本上,我的想法是让所有流量都流向 Nginx。 在那里,我需要知道 mail.domain.org 的内容并将其重定向到 Exchange。具体来说,我需要一切才能工作。 OWA,自动发现:好的。但我正在为似乎是 RPC 的东西而苦苦挣扎。

有人提到我应该在 Nginx 中使用 stream 配置来管理它。

但我不知道如何区分,所以只有 mail.domain.org 使用流,而 apps.domain.org 在 http 配置中?


我当前的配置(感谢下面的链接,但特别是 tigunov 关于让 Outlook Anywhere 又名 RPC 工作的评论)让我比以前更进一步。当前,当我尝试 Microsoft 的远程连接分析器时,FolderSync 尝试失败。在 Outlook 中,凭据框仍会弹出。


server {
       (server_name , SSL-certs etc)

        # Set global proxy settings
        proxy_pass_header       Date;
        proxy_pass_header       Server;

        proxy_set_header        Host $host;
        proxy_set_header        X-Real-IP $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header        Accept-Encoding "";


        keepalive_timeout 3h;
        proxy_read_timeout 3h;
        #reset_timedout_connection on;
        tcp_nodelay on;
        client_max_body_size 3G;
        #proxy_pass_header Authorization;
        proxy_pass_request_headers on;
        proxy_http_version 1.1;
        proxy_request_buffering off;
        proxy_buffering off;
        proxy_set_header Connection "Keep-Alive";

}

现在测试结果:(一切正常,包括 ActiveSync - OPTIONS),但是:

Attempting the FolderSync command on the Exchange ActiveSync session.
The test of the FolderSync command failed.

Exception details:
Message: The request was aborted: The request was canceled.
Type: System.Net.WebException
Stack trace:

at System.Net.HttpWebRequest.GetResponse()
at Microsoft.Exchange.Tools.ExRca.Extensions.RcaHttpRequest.GetResponse()
Elapsed Time: 526 ms. 

在连接工具中没有更多详细信息。

【问题讨论】:

    标签: ssl nginx proxy exchange-server activesync


    【解决方案1】:

    此配置基于 Tad DeVries 的配置 here 和 Daniel Kempkens 对自动发现和 RPC 问题的修复 here

    请注意,由于我没有要测试的 Exchange 环境,我不确定此配置是否可以正常工作,但值得一试。

    server {
            listen 80;
            #listen [::]:80;
            server_name mail.gwtest.us autodiscover.gwtest.us;
            return 301 https://$host$request_uri;
    }
    
    server {
            listen 443;
            #listen [::]:443 ipv6only=on;
            ssl                     on;
            ssl_certificate         /etc/ssl/nginx/mail.gwtest.us.crt;
            ssl_certificate_key     /etc/ssl/nginx/mail.gwtest.us.open.key;
            ssl_session_timeout     5m;
    
            server_name mail.gwtest.us;
    
            location / {
                    return 301 https://mail.gwtest.us/owa;
            }
    
            proxy_http_version      1.1;
            proxy_read_timeout      360;
            proxy_pass_header       Date;
            proxy_pass_header       Server;
            proxy_pass_header       Authorization;
    
            proxy_set_header        Accept-Encoding "";
            proxy_set_header        Host $host;
            proxy_set_header        X-Real-IP $remote_addr;
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    
            more_set_input_headers 'Authorization: $http_authorization';
            more_set_headers -s 401 'WWW-Authenticate: Basic realm="exch1.test.local"';
    
            location ~* ^/owa { proxy_pass https://exch1.test.local; }
            location ~* ^/Microsoft-Server-ActiveSync { proxy_pass https://exch1.test.local; }
            location ~* ^/ecp { proxy_pass https://exch1.test.local; }
            location ~* ^/rpc { proxy_pass https://exch1.test.local; }
            #location ~* ^/mailarchiver { proxy_pass https://mailarchiver.local; }
    
            error_log /var/log/nginx/owa-ssl-error.log;
            access_log /var/log/nginx/owa-ssl-access.log;
    }
    

    【讨论】:

      猜你喜欢
      • 2014-03-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-22
      • 1970-01-01
      • 2021-06-17
      • 2017-07-21
      • 2011-10-20
      相关资源
      最近更新 更多