WebMail Pro 7 documentation

DAV server configuration


WebMail Pro uses CalDAV server to store and process calendar entries, and CardDAV server is used for storing contacts and groups. Eventually, it's the same DAV server used, and it's a solid part of WebMail Pro. In most cases, it will work out of the box, but you might need to perform additional reconfiguration, particularly if you plan to use mobile sync feature.

URL rewriting

When you set up the product using built-in installation wizard, it will automatically detect URL used for CalDAV sync. Default value is


(note that trailing slash is mandatory). For this to work with Apache, you might need to recheck that AcceptPathInfo is not disabled in Apache configuration.

It is strongly advised to configure your web server so that URLs are rewritten and easier to enter from, say, mobile device.

Configuring Apache

For Apache web server, URL rewriting is ensured by adding virtual host with the following configuration:

DocumentRoot /var/www/webmail/dav/
RewriteEngine On
RewriteRule ^/(.*)$ /server.php [L]

DocumentRoot should point to dav subdirectory of WebMail installation location. Standard port 80 is used. Many applications, however, treat port 8008 as a default one, configuration would look a bit different in this case:

NameVirtualHost *:8008
Listen 8008

DocumentRoot /var/www/webmail/dav/
RewriteEngine On
RewriteRule ^/(.*)$ /server.php [L]

Also, you need to make sure http methods required by CalDAV server are not blocked in web server configuration. If there are LimitExcept directives used in VirtualHost or Directory containers, those should be removed: these directives might be blocking HTTP methods (such as MKCOL, PUT, PROPPATCH etc.) which will make the use of DAV impossible.

Configuration for nginx

For nginx webserver, add the following rule to your current location:

root webmail/dav;
index server.php;

if ( !-d $request_filename) {
    rewrite ^(.*) /server.php last;

In the above configuration sample, webmail stands for WebMail installation location which is subdirectory of web server document root.

To make sure all the http methods required by DAV server are allowed, the following configuration is performed:


It should point to existing PHP backend or another web server where PHP backend runs.

Typical host configuration would look like:

location /dav.php {
    include fastcgi_params;

    fastcgi_read_timeout 180s;
    fastcgi_pass  unix:/opt/afterlogic/tmp/php5-fpm.sock;
    fastcgi_param  SCRIPT_FILENAME  $document_root/dav.php;

    fastcgi_split_path_info ^(.+\.php)(/[^?]*).*$;

    fastcgi_param  SCRIPT_NAME      $fastcgi_script_name;
    fastcgi_param  PATH_INFO        $fastcgi_path_info;

However, if you choose to use a separate domain or subdomain for DAV access, configuration will be different:

location = / {
    try_files @dav @dav;

location / {
    try_files $uri $uri/ @dav;

location ~* \.php$ {
    return 404;

location @dav {
    include fastcgi_params;
    fastcgi_read_timeout   180s;
    fastcgi_pass    unix:/opt/afterlogic/tmp/php5-fpm.sock;
    fastcgi_index   server.php;
    fastcgi_param   SCRIPT_FILENAME $document_root/server.php;

Configuring .well-known access

Another good way of ensuring proper mobile sync setup is to use .well-known access. Various clients, including the one used in iOS, attempt to determine correct DAV URL by sending request to a special subdirectory name, and we can handle those requests to redirect to DAV server.

In case of Apache, configuration would look like:

RewriteEngine on
RewriteRule .* - 
Redirect 301 /.well-known/carddav /dav/server.php/
Redirect 301 /.well-known/caldav /dav/server.php/

For nginx, the following configuration should help:

location / {
   rewrite ^/.well-known/carddav /dav/server.php/ redirect;
   rewrite ^/.well-known/caldav /dav/server.php/ redirect;

NB: With configuration settings supplied that way, you'll need to use your WebMail installation URL as DAV URL, without any suffixes etc.


Once the product is installed and webserver is fully configured for DAV support, you should be able to sync your mobile device with your WebMail account. Sync URL is found in the account settings. Entering just the URL would be fine, but if port 8008 is used, the http:// part should be omitted.

If you're having troubles using sync via DAV, check Mobile Sync / Troubleshooting documentation page section. And in case if you're using cPanel, check this documentation section.