-
-
Save atn93/e130e3acce1b5044da7c547af980c089 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# nginx@nginx:~$ cat /etc/nginx/sites-available/outlook.conf | |
server { | |
listen 192.168.128.2:80; | |
server_name yourdomain.com; | |
return 301 https://yourdomain.com$request_uri; | |
} | |
server { | |
listen 192.168.128.2:443; | |
server_name yourdomain.com; | |
set $exchange2016 https://192.168.128.112:443; | |
# Redirect from "/" to "/owa" by default | |
rewrite ^/$ https://yourdomain.com/owa permanent; | |
# Enable SSL | |
ssl on; | |
ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem; | |
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; | |
# RPC Exchange 2010 (https://gist.github.com/taddev/7275873#gistcomment-3555437) | |
# proxy_set_header Authorization $http_authorization; | |
# proxy_pass_header Authorization; | |
location ~* ^/owa { proxy_pass $exchange2016; } | |
location ~* ^/Microsoft-Server-ActiveSync { proxy_pass $exchange2016; } | |
location ~* ^/ecp { proxy_pass $exchange2016; } | |
location ~* ^/Rpc { proxy_pass $exchange2016; } | |
#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; | |
} | |
server { | |
listen 192.168.128.2:443; | |
server_name autodiscover.yourdomain.com; | |
# Enable SSL | |
ssl on; | |
ssl_certificate /etc/letsencrypt/live/autodiscover.yourdomain.com/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/autodiscover.yourdomain.com/privkey.pem; | |
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; | |
# RPC Exchange 2010 (https://gist.github.com/taddev/7275873#gistcomment-3555437) | |
# proxy_set_header Authorization $http_authorization; | |
# proxy_pass_header Authorization; | |
location ~* ^/Autodiscover { proxy_pass $exchange2016; } | |
error_log /var/log/nginx/owa-ssl-error.log; | |
access_log /var/log/nginx/owa-ssl-access.log; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment