Configuring DAV server

Introduction

Aurora Cloud uses DAV server internally, for storing data and syncing it with mobile and other clients. Typically, it will work out of the box, but you might need to perform additional reconfiguration, depending on your needs and specific environment.

By default, URL used for DAV sync is not supplied in product configuration. Standard URL would look like http://www.yourdomain.com/cloud/dav.php, where http://www.yourdomain.com/cloud/ is URL pointing to Aurora Cloud installation. 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/cloud/
RewriteEngine On
RewriteRule ^/(.*)$ /dav.php [L]
</VirtualHost>

DocumentRoot should point to root directory of Aurora Cloud 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/cloud/
RewriteEngine On
RewriteRule ^/(.*)$ /dav.php [L]
</VirtualHost>

Also, you need to make sure http methods required by DAV server are not blocked in web server configuration. If there are LimitExcept directives used in VirtualHost or Directory containers, those should be removed.

Configuration for nginx

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

root cloud;
index dav.php;
if ( !-d $request_filename) {
    rewrite ^(.*) /dav.php last;
}

In the above configuration sample, cloud stands for Aurora Cloud installation location.

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

if ($request_method ~ ^(OPTIONS|GET|HEAD|DELETE|PROPFIND|PUT|PROPPATCH|COPY|MOVE|MKCOL|REPORT)$) {
    fastcgi_pass 127.0.0.1:1028;
}

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

Typical host configuration would look like:

location / {
    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   dav.php;
    fastcgi_param   SCRIPT_FILENAME $document_root/dav.php;
}