Using DAVdroid with lighttpd

I used https://mybaseurl/remote.php/caldav as url during my first DAVdroid installation. Everything works fine.

Today, in order to get an A+ for the security check, I amend the DocumentRoot path by removing the “nextcloud” portion. Obviously, DAVdroid can sync no more then. Stupid me forget the original url used (above mentioned) and it took me some time to figure out it back. During the process, I find from https://www.davdroid.com/manual/accounts/ that the recommended way is to use root URL (/) with well-known URLs being configured.

I google a bit and it seems to me that (dot)well-known is from nginx that I have zero experience with. It also co-exist quite frequently with Letsencrypt. Do you gentlemen have any basic guide or good tutorial that I can follow and learn what (dot)well-known is, how it works, particularly under lighttpd?

Thanks

p.s. the whole setup is for OpenTasks, so I put this thread here.

The /.well-known/ is not from nginx, but RFC 5785. So, no knowledge on nginx is needed to proceed.

Letsencrypt/certbot creates .well-known/acme-challenge during certification creation and removes it during clean up makes it a bit mystery (to me, at least). It is not.

Add the following lines to lighttpd’s conf file, and I don’t need to add /remote.php/caldav to the url of DAVdroid a/c on Android anymore. Even better, I get carddav working too.

url.redirect = (
       "^/.well-known/carddav" => "/remote.php/carddav",
       "^/.well-known/caldav" => "/remote.php/caldav",
)

I copy it from a bug (other issue) report on https://redmine.lighttpd.net. I tested, it works. But I still have not found any proper document on this topic and have no idea if above lines will induce any vector that risk being compromised. Any input is still welcome.