Публикация MS Exchange OWA через NGINX

Материал из My WiKi
Перейти к навигации Перейти к поиску

Создаем файл exchange.conf в /etc/nginx/conf.d

 server {
   listen 80;
   server_name mail.360.ru;
   return 301 https://exchange.nginx.360.ru;
 }
 server {
   listen 443 ssl;
   server_name exchange.nginx.360.ru;
   set $exchange2010 https://192.168.100.2;
   rewrite ^/$ https://exchange.nginx.360.ru/owa permanent;
   ssl_certificate /etc/letsencrypt/live/exchange.nginx.360.ru/fullchain.pem;
   ssl_certificate_key /etc/letsencrypt/live/exchange.nginx.360.ru/privkey.pem;
   include /etc/letsencrypt/options-ssl-nginx.conf;
   ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
   client_max_body_size 3G;
   proxy_read_timeout 3h; 
   proxy_pass_header Date; 
   proxy_pass_header Server; 
   proxy_pass_request_headers on;
   proxy_http_version 1.1;
   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_request_buffering off;
   proxy_buffering off;
   proxy_set_header Connection "Keep-Alive";
   location / 					{ proxy_pass $exchange2010; }        
   location ~* ^/owa				{ proxy_pass $exchange2010; }
   location ~* ^/Microsoft-Server-ActiveSync 	{ proxy_pass $exchange2010; }
   location ~* ^/ecp 				{ proxy_pass $exchange2010; }
   location ~* ^/Rpc 				{ proxy_pass $exchange2010; }
   location ~* ^/ews 				{ proxy_pass $exchange2010; }
   location ~* ^/exchweb 			{ proxy_pass $exchange2010; }
   location ~* ^/public 			{ proxy_pass $exchange2010; }
   location ~* ^/exchange 			{ proxy_pass $exchange2010; }
   location ~* ^/autodiscover 			{ proxy_pass $exchange2010; }
   error_log /var/log/nginx/owa-ssl-error.log;
   access_log /var/log/nginx/owa-ssl-access.log;
 }