简体   繁体   English

Nginx作为Exchange代理

[英]Nginx as Exchange-proxy

I've been looking for a solution for this for quite a few hours already. 我已经在寻找解决方案已有好几个小时了。 I'm rather new to Nginx as well, so if someone could help me with a demo config, it would be superb. 我也是Nginx的新手,所以如果有人可以帮助我进行演示配置,那将是极好的。

  • 1 public IP address (this is what's causing so much trouble) 1个公用IP地址(这引起了很多麻烦)
  • Nginx as proxy Nginx作为代理
  • Exchange 2013 Exchange 2013

Current situation: 现在的情况:

  • http: apps.domain.org, video.domain.org, geo.domain.org . http:apps.domain.org,video.domain.org,geo.domain.org。 Traffic on port 80 goes to the Nginx server. 端口80上的流量将流向Nginx服务器。
  • https: mail.domain.org . https:mail.domain.org。 Traffic on port 443 goes straight to Exchange 2013. 端口443上的流量直接进入Exchange 2013。

Now, we need https / SSL on our apps.domain.org . 现在,我们需要在apps.domain.org上使用https / SSL。 Our firewall only checks the IP addresses and forwards traffic. 我们的防火墙仅检查IP地址并转发流量。

So basically, my idea is to have all traffic go to Nginx. 所以基本上,我的想法是让所有流量都流向Nginx。 There, I need to know what's for mail.domain.org and redirect it to Exchange. 在那里,我需要知道mail.domain.org的含义并将其重定向到Exchange。 Specifically, I need everything to work. 具体来说,我需要一切正常工作。 OWA, autodiscover: OK. OWA,自动发现:好的。 But I'm struggling with what seems to be RPC . 但是我正在为似乎是RPC的问题而苦苦挣扎。

Someone mentioned I should use a stream config in Nginx to manage that. 有人提到我应该在Nginx中使用配置来管理它。

But I don't know how to differentiate, so that only mail.domain.org uses a stream, while apps.domain.org is in a http config? 但是我不知道如何区分,以便只有mail.domain.org使用流,而apps.domain.org在http配置中?


My current config (thanks to the links below, but in particular tigunov's comment about getting Outlook Anywhere aka RPC to work) gets me further than before. 我当前的配置(由于下面的链接,尤其是tigunov关于使Outlook Anywhere或RPC正常工作的评论)使我比以前更进一步。 Currently failing at a FolderSync attempt when I try Microsoft's Remote Connectivity Analyzer. 我尝试使用Microsoft的远程连接分析器时,当前在FolderSync尝试上失败。 In Outlook, the credentials box still pops up. 在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";

}

Test now results in: (everything fine, including ActiveSync - OPTIONS), but: 现在,测试结果为:(一切正常,包括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. 

No further details to be seen in the connectivity tool. 连接工具中没有其他详细信息。

This configuration is based on Tad DeVries' configuration found here and Daniel Kempkens' fix for autodiscover and RPC issues found here . 这个配置是基于泰德DeVries医师配置发现这里和丹尼尔Kempkens'修复为发现自动发现和RPC的问题在这里

Note that since I don't have an Exchange environment to test against, I'm not sure if this configuration will work properly, but it's worth a try. 请注意,由于我没有要测试的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;
}

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

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