Z-Push with Dovecot and nginx

Today I tried to activate push mail for my private mail server. And what should I say… It works like a charm.

Prerequisites:

  • Dovecot IMAP
  • NGINX configured with SSL

To activate get the latest version of Z-Push. Unpack to /usr/share/z-push. Now you need to make some configuration changes:

At least you should change the backend provider in /usr/share/z-push/config.php:

define('BACKEND_PROVIDER', 'BackendIMAP');

If you use SSL with your IMAP change the configuration in /usr/share/z-push/backend/imap/config.php:

define('IMAP_PORT', 993); define('IMAP_OPTIONS', '/ssl/novalidate-cert');

Last but not least you have to point https://server.tld/Microsoft-Server-ActiveSync to your Z-Push installation. If you already configured NGINX with SSL you can add a new location to your config:

location /Microsoft-Server-ActiveSync {
alias /usr/share/z-push/index.php;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
access_log /var/log/nginx/as.log;
error_log /var/log/nginx/as_error.log;
}

You can test your configuration by opening https://server.tld/Microsoft-Server-ActiveSync in your browser. If you are prompted to authenticate with your username and password, everything works fine.

Now you have configured the server side of your push mail configuration. To gain the full functionality on your mobile device, you need to reconfigure you mail client. Choose Exchange as your mailprovider. Fill your username, password and server. Choose accept all certifcates and use your new push mail account.