There is a task - you need to remove the slash at the end of the URL. while for the webmail folder it should remain (roundcube is connected to this URL and it generates URLs like / webmail /? _ task = mail & _mbox = INBOX).

do so

location /webmail/ { alias /var/lib/roundcube/; ...... } #убираем слеш в конце rewrite ^/(.*)/$ /$1 permanent; 

but it turns out an endless redirect with a slash / without a slash, although the first is the rule for processing mail. On the rest of the site everything is working fine.

how to fix?

    0