Stefan Seidel

Z-Push on Zimbra 8

The easy way to install Z-Push (support for ActiveSync) on Zimbra 8. It does not require additional servers. The installation happens on the Zimbra server where the Proxy is installed.

Since the Zimbra Proxy is nginx, we will use php-fpm to provide a nice way of separating the Z-Push components from the main Zimbra components.


Find out the URL for the latest Z-Push from here:

I used the latest version, 2.3 at the time. Once you have the URL, go to your zimbra server as root and type

wget -O z-push.tar.gz

Now we create the Z-Push directory and unpack it there:

mkdir -p /var/www/z-push
tar cf z-push.tar.gz --strip-components=1 -C /var/www/z-push

Now we need to get the Z-Push Zimbra Backend:

wget -O zpushzimbra.tar.gz

and also extract it to the correct directory:

mkdir -p /var/www/z-push/backend/zimbra
tar xf zpushzimbra.tar.gz --strip-components=1 -C /var/www/z-push/backend/zimbra

We will also install php-fpm, depending on your distro it's something like

yum install -y php-pecl-memcached php-cli php-soap php-process php-mbstring php-fpm


apt-get install php5-memcached php5-cli php-soap php5-fpm

And finally we create some directoryes for logging and state:

mkdir -p /var/log/z-push /var/lib/z-push
chown apache: /var/log/z-push /var/lib/z-push # on CentOS/RHEL/Fedora
chown www-data: /var/log/z-push /var/lib/z-push # on Debian/Ubuntu


Now we need to configure Z-Push to use the Zimbra Backend. Edit the file /var/www/z-push/config.php and edit these two settings:

  • find the line: define('USE_X_FORWARDED_FOR_HEADER', false);
    • change it to: define('USE_X_FORWARDED_FOR_HEADER', true);
  • find the line: define('BACKEND_PROVIDER', '');
    • change it to: define('BACKEND_PROVIDER', 'BackendZimbra');

Now edit the file /var/www/z-push/backend/zimbra/config.php

  • add a line with the text:  define('ZIMBRA_URL', '');
  • adjust other settings as needed, first try it as it is

Obviously replace with the address of your Zimbra installation.

Finally we need to make the Zimbra Proxy use Z-Push. Edit the file /opt/zimbra/conf/nginx/templates/nginx.conf.web.https.default.template and make these changes:

     location ^~ /Microsoft-Server-ActiveSync
         # Begin stray redirect hack

         # End stray redirect hack
-        # Proxy to Zimbra Upstream
-        proxy_pass          ${};
-        proxy_read_timeout  ${web.upstream.polling.timeout};
-        proxy_buffering     off;
+        # Z-PUSH start
+        include /etc/nginx-php-fpm.conf;
+        # Z-PUSH end

         # For audit

This references the file /etc/nginx-php-fpm.conf which should have this content:

fastcgi_param   QUERY_STRING            $query_string;
fastcgi_param   REQUEST_METHOD          $request_method;
fastcgi_param   CONTENT_TYPE            $content_type;
fastcgi_param   CONTENT_LENGTH          $content_length;

fastcgi_param   SCRIPT_NAME             $fastcgi_script_name;
fastcgi_param   PATH_INFO               $fastcgi_path_info;
fastcgi_param   PATH_TRANSLATED         $document_root$fastcgi_path_info;
fastcgi_param   REQUEST_URI             $request_uri;
fastcgi_param   DOCUMENT_URI            $document_uri;
fastcgi_param   DOCUMENT_ROOT           $document_root;
fastcgi_param   SERVER_PROTOCOL         $server_protocol;

fastcgi_param   GATEWAY_INTERFACE       CGI/1.1;
fastcgi_param   SERVER_SOFTWARE         nginx/$nginx_version;

fastcgi_param   REMOTE_ADDR             $remote_addr;
fastcgi_param   REMOTE_PORT             $remote_port;
fastcgi_param   SERVER_ADDR             $server_addr;
fastcgi_param   SERVER_PORT             $server_port;
fastcgi_param   SERVER_NAME             $server_name;

fastcgi_param   HTTPS                   $https;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param   REDIRECT_STATUS         200;

fastcgi_param HTTP_PROXY "";
fastcgi_param SCRIPT_FILENAME /var/www/z-push/index.php;

client_max_body_size 20m;
client_body_buffer_size 128k;
keepalive_timeout  65;

# max_execution_time is 900
proxy_read_timeout 910;
fastcgi_read_timeout 910;

sendfile  on;

Notice that we hard-code the SCRIPT_FILENAME to the Z-Push index.php, so there is no need for any redirects.

Now we regenerate the Proxy configuration:

sudo -u zimbra /opt/zimbra/bin/zmconfigdctl restart

Enable and start PHP-FPM

systemctl enable php-fpm # or php5-fpm for Debian/Ubuntu
systemctl start php-fpm # or php5-fpm for Debian/Ubuntu

And finally restart the Proxy itself:

sudo -u zimbra /opt/zimbra/bin/zmproxyctl restart

Now you should be able to use ActiveSync with Zimbra.