Introduction
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
http://yourhost.com/dav/server.php/
(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:
<VirtualHost>
DocumentRoot /var/www/webmail/dav/
RewriteEngine On
RewriteRule ^/(.*)$ /server.php [L]
</VirtualHost>
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
<VirtualHost>
DocumentRoot /var/www/webmail/dav/
RewriteEngine On
RewriteRule ^/(.*)$ /server.php [L]
</VirtualHost>
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, the following configuration ensures `/dav.php/` access works as expected:
location ~ ^(.+\.php)(.*)$ {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/run/php/php-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
If you choose to use a separate domain or subdomain for DAV access, configuration would look like:
server {
listen 80;
server_name dav.server.com;
root /var/www/html;
index dav.php;
location = / {
try_files @dav @dav;
}
location / {
try_files $uri $uri/ @dav;
}
location @dav {
fastcgi_pass unix:/run/php/php-fpm.sock;
include fastcgi_params;
fastcgi_index dav.php;
fastcgi_param SCRIPT_FILENAME $document_root/dav.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:
<IfModule>
RewriteEngine on
RewriteRule .* -
Redirect 301 /.well-known/carddav /dav/server.php/
Redirect 301 /.well-known/caldav /dav/server.php/
</IfModule>
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.
Conclusion
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.