Created
May 2, 2016 20:37
-
-
Save rafaelfoster/95063e317626bc02d1cee76ce0ab7c9c to your computer and use it in GitHub Desktop.
Nginx configuration to create reverse proxy to Zimbra Mail Client and enable ActiveSync based on Z-PUSH.
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
upstream zimbramailserver { | |
server localhost:8443 weight=1 fail_timeout=300s; # Zimbra Mail client HTTPS port | |
} | |
server { | |
listen 80; | |
server_name mail.*; | |
return 301 https://$host$request_uri; | |
} | |
server { | |
server_name mail.*; | |
listen 443 ssl; | |
index index.php; | |
ssl on; | |
ssl_certificate /etc/letsencrypt/archive/mail.example.com/cert1.pem; | |
ssl_certificate_key /etc/letsencrypt/archive/mail.example.com/privkey1.pem; | |
access_log /var/log/nginx/mail-access.log; | |
error_log /var/log/nginx/mail-error.log; | |
root /var/www/html/z-push; | |
location /Microsoft-Server-ActiveSync { | |
rewrite ^(.*)$ /index.php last; | |
} | |
location ~ \.(hh|php)$ { | |
fastcgi_keep_conn on; | |
fastcgi_pass 127.0.0.1:9001; | |
fastcgi_index index.php; | |
fastcgi_buffers 8 16k; | |
fastcgi_buffer_size 32k; | |
fastcgi_connect_timeout 300; | |
fastcgi_send_timeout 300; | |
fastcgi_read_timeout 300; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
location / { | |
proxy_pass https://zimbramailserver; | |
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Proto https; | |
proxy_redirect off; | |
proxy_read_timeout 5m; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Olá!
Eu tenho mais/menos esse cenário...
No servidor web tem o site e o zimbra está em outro servidor, daí preciso fazer um proxy pro zimbra... eu uso o CloudFlare como DNS... O Zimbra envia email mas não recebe, porque ele consulta no IP do servidor-web...