Home / GitHub Page

Self-hosted WebDAV sync is very slow + I see Nginx errors on the server

Version info:

  • OS: Linux Mint 19.3 Tricia
  • Linux kernel: 5.3.0-51-generic
  • Joplin: 1.0.201 (prod, linux) AppImage
  • WebDAV server: Nginx 1.14.2

I set up WebDAV hosting with Nginx, and I am attempting to use it for synchronizing a brand new Joplin installation.

I am able to connect and upload/manage files using Curl, Cadaver, and Nemo. However when Joplin attempts to synchronize, two things happen:

  1. Synchronization takes a long time
  2. I get several Nginx errors, for example:
2020/05/21 21:59:18 [error] 26452#26452: *2 mkdir() "/var/www/webdav/.lock" failed (17: File exists), client: 207.38.230.21, server: webdav.<my domain>, request: "MKCOL /.lock/ HTTP/1.1", host: "webdav.<my domain>"

Is this a problem? Are my notes safely synchronized?

Also, synchronization takes a long time, sometimes several minutes. This is a fresh installation, with only the default “Welcome” notebook. I’m running on a relatively low-powered VPS, but I don’t see CPU or memory usage spiking on the server while synchronization is in progress. I also don’t see a large amount of disk reads or writes happening, so slow disk i/o doesn’t seem to be the problem either.

My Nginx “site” is configured as follows (and symlinked to /etc/nginx/sites-enabled):

server {
        listen 80;
        listen [::]:80;
        server_name webdav.<my domain>;
        return 302 https://$host$request_uri;
}

server {
        listen 443 ssl;
        listen [::]:443 ssl;
        server_name webdav.<my domain>;
        include ssl/<my domain>.conf;

        auth_basic <my realm name>;
        auth_basic_user_file /etc/nginx/webdav-passwords;

        dav_methods PUT DELETE MKCOL COPY MOVE;
        dav_ext_methods PROPFIND OPTIONS;
        dav_access user:rw group:rw all:r;

        client_body_temp_path   /tmp/nginx-client-bodies;
        # Don't check body size
        client_max_body_size    0;
        # Technically violates WebDAV spec - create parent directories if they don't exist
        create_full_put_path    on;

        root /var/www/webdav;
        # Automatically generate index.html; without this option, Nginx throws 403 on attempt to access a directory without an index page.
        autoindex on;
}

I am sure that /var/www/webdav is owned by www-data:www-data (which is the Nginx user) with permissions 2755/drwxr-sr-x).

This might help with slow sync: https://github.com/laurent22/joplin/pull/2577
I don’t think it’s been released yet so you can either try a pre-release version from github or wait for the next release.

Thanks. I’d still like to know about the “file exists” errors.