You should remove
0 => 'localhost',
5 => 'nextcloudpi.local',
8 => 'nextcloudpi.lan',
from the ‘trusted_domains’ array and set your local DNS so that cloud.{MYDOMAIN].com points to your server’s local IP.
Please read this 101 tutorials:
h.t.h.
Much and good luck,
ernolf