I'm new in nginx reverse proxy
my problem is outlook cant connect to echange server with auto discovery and open IMAP with this config :
server {
listen 80;
server_name email.mydomain.com;
return 301 https://email.mydomain.com$request_uri;
}
server {
listen 443;
server_name email.mydomain.com;
set $exchange2019 https://internal.ip;
# Redirect from "/" to "/owa" by default
rewrite ^/$ https://email.mydomain.com/owa permanent;
# Enable SSL
ssl on;
ssl_certificate /etc/nginx/ssl/email-mobile/Exg-Mobile.crt;
ssl_certificate_key /etc/nginx/ssl/email-mobile/Exg-Mobile.rsa;
ssl_session_timeout 5m;
# Set global proxy settings
proxy_pass_request_headers on;
proxy_read_timeout 360;
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 Authorization $http_authorization;
# proxy_pass_header Authorization;
location ~* ^/owa { proxy_pass $exchange2019; }
location ~* ^/Microsoft-Server-ActiveSync { proxy_set_header X-Forwarded-Proto https; proxy_pass $exchange2016; }
location ~* ^/ecp { proxy_pass $exchange2019; }
location ~* ^/Rpc { proxy_pass $exchange2019; }
#location ~* ^/mailarchiver { proxy_pass https://mailarchiver.local;}
# location ~* ^/Autodiscover { proxy_pass $exchange2016/Autodiscover; }
# location ~* ^/autodiscover { proxy_pass $exchange2016/autodiscover; }
error_log /var/log/nginx/owa-ssl-error.log;
access_log /var/log/nginx/owa-ssl-access.log;
}
server {
listen 443;
server_name autodiscover.mydomain.com;
set $exchange2019 https://internal.ip;
# Enable SSL
ssl on;
ssl_certificate /etc/nginx/ssl/email-mobile/Exg-Mobile.crt;
ssl_certificate_key /etc/nginx/ssl/email-mobile/Exg-Mobile.rsa;
ssl_session_timeout 5m;
# Set global proxy settings
proxy_pass_request_headers on;
proxy_read_timeout 360;
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 Authorization $http_authorization;
proxy_pass_header Authorization;
location ~* ^/Autodiscover { proxy_pass $exchange2019/Autodiscover; }
location ~* ^/autodiscover { proxy_pass $exchange2019/autodiscover; }
error_log /var/log/nginx/owa-ssl-error.log;
access_log /var/log/nginx/owa-ssl-access.log;
}
I want to connect to my exchange server from outlook from my internal network and out side with autodiscover but when i add my email address to my outlook IMAP is coming but i want another page in the picture