Configuring Z-Push ActiveSync for Ubuntu Email Server
11:59, 14.08.2026
Z-Push ActiveSync is important in case you want to synchronize tasks, contacts, and emails between the desktop device and mobile gadgets.
By default, the users of email clients have a specific time frame during which the server is checked and push email appears. To speed up this process, Z-Push can also be used. So, in This guide we will discuss some configuration insights about Z-Push for Ubuntu users.
What You’ll Need to Get Started
To start the process, you should already have a Ubuntu mail server that is properly functioning. In case, you don’t have it, there are lots of guides with detailed explanations of how to set up everything properly.
Step 1: Set Up Z-Push on Your Ubuntu Mail Server
Enter the mail server and use the following line:
sudo apt install z-push z-push-backend-imap z-push-common
Once in the installation process, you will be offered Lighttpd or Apache as a web server for automatic configuration. In case, you use the Nginx server, you should press Tab and Enter to skip this process of selection.
Those who will select the Apache server will create 2 configuration files. However, in this guide we will only share the set-up process with IMAP backend for email synchronization.
sudo apt install z-push-backend-combined z-push-backend-caldav z-push-backend-carddav z-push-backend-kopano
For the configuration of auto-discovery use:
sudo nano /etc/z-push/utodiscover.conf.php
After that find and set up your time zone, and find the next line where you should change false to true:
define('USE_FULLEMAIL_FOR_LOGIN', false);
Then find the backend setting and switch on the IMAP backend, and close the file with all the saved changes.
Now let’s edit imap.conf.php:
sudo nano /etc/z-push/imap.conf.php
Search for the part with IMAP settings where you should enable TLS encryption. Specify the server address in the defining part, add port, and add /ssl in IMAP_OPTIONS.
Next, mention smtp in IMAP_SMTP_METHOD. In this parameter $imap_smtp_params add SMTP settings of the server that include address, port, username, and password. The last thing to change before the saving is IMAP_FOLDER_CONFIGURED, it should be true. Once that is done, you can close the file with all the saved changes.
Step 2: Add Essential PHP Extensions
Z-Push isn’t compatible with PHP 8, so you can use version 7.4 and the installation looks like this:
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php-soap php7.4-common php7.4-soap php7.4-fpm php7.4-imap php7.4-mbstring
In case, you use an Apache server, the process starts with disabling of PHP7 and MPM:
sudo a2dismod php7.4
sudo a2dismod mpm_prefork
Then use the following commands:
sudo a2enmod mpm_event proxy_fcgi setenvif
sudo a2enconf php7.4-fpm
The final point will be the restart of the Apache server with:
sudo systemctl restart apache2
Step 3: Configure Your Web Server for Z-Push
Nginx Configuration for Z-Push
Start the process with the creation of the file:
sudo nano /etc/nginx/conf.d/z-push.conf
Add the following lines to the file:
server {
listen 80;
listen [::]:80;
server_name insert your real name;
access_log /var/log/nginx/z-push.access;
error_log /var/log/nginx/z-push.error;
location ~* /AutoDiscover/AutoDiscover.xml {
alias /usr/share/z-push/autodiscover/autodiscover.php;
include /etc/nginx/fastcgi.conf;
fastcgi_read_timeout 3660;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
location ~* /Microsoft-Server-ActiveSync {
alias /usr/share/z-push/index.php;
include /etc/nginx/fastcgi.conf;
fastcgi_read_timeout 3660;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
}
Then test if everything functions properly and reload the Nginx server.
Apache Configuration for Z-Push
Start with the file creation:
sudo nano /etc/apache2/sites-availabe/z-push.conf
Add the following info to the created file:
<VirtualHost *:80>
ServerName insert real name in here
<IfModule mod_alias.c>
Alias /Microsoft-Server-ActiveSync /usr/share/z-push/index.php
</IfModule>
<Directory /usr/share/z-push>
DirectoryIndex index.php
Options -Indexes +FollowSymLinks
AllowOverride none
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
<Files "config.php">
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
</Files>
</Directory>
<IfModule mod_alias.c>
Alias /AutoDiscover/AutoDiscover.xml "/usr/share/z-push/autodiscover/autodiscover.php"
Alias /Autodiscover/Autodiscover.xml "/usr/share/z-push/autodiscover/autodiscover.php"
Alias /autodiscover/autodiscover.xml "/usr/share/z-push/autodiscover/autodiscover.php"
</IfModule>
Include /etc/apache2/conf-available/php7.4-fpm.conf
</VirtualHost>
After that, you should restart the server.
Step 4: Secure Your Email with HTTPS
To secure your email, install Let’s Encrypt with the following command:
sudo apt install certbot
For the users of Nginx, it is also a necessity to add this step:
sudo apt install python3-certbot-nginx
To install the certificate, use the next line:
sudo certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email you@name.com -d autodiscover.name.com
For the Apache users, start with:
sudo apt install python3-certbot-apache
To install the certificate, use the following line:
sudo certbot --apache --agree-tos --redirect --hsts --staple-ocsp --email you@name.com -d autodiscover.name.com
After you’ve restarted the server, everything should function properly. If not, we will share a couple of errors that you can easily fix later in the guide.
Step 5: Activate Push Email on Mobile Devices
iPhone users can activate push emails by going to the settings, selecting mail, then accounts, and adding accounts. While in the process of enabling activation choose Microsoft Exchange. After that fill in the email, choose manual configuration, and enter the PW. Enter credentials once again and add server info.
Failed to Connect to the Server? Here’s Why
Usually, failure with connection to the server occurs because of the wrong PHP version so you should just update it for Z-Push to work properly.
Can’t Verify Account Information? Fix it Here
To verify account info, you will need to edit Dovecot configuration file. Enter the file with:
sudo nano /etc/dovecot/conf.d/10-auth.conf
Find the line with the default realm and after uncommenting add the domain there and restart.
How to Diagnose Issues Using Server Logs
For Nginx use:
/var/log/nginx/z-push.error.
To diagnose server logs in Apache:
/var/log/apache2/z-push_error.log.
Z-push logs:
/var/log/z-push/
To Sum Up
Hope now you have full information about the configuring of Z-Push ActiveSync for the Ubuntu email server.