Install the LDAP app if it's not already.
ldap
ldap:check-user checks whether a user exists on LDAP.
ldap:create-empty-config creates an empty LDAP configuration
ldap:delete-config deletes an existing LDAP configuration
ldap:search executes a user or group search
ldap:set-config modifies an LDAP configuration
ldap:show-config shows the LDAP configuration
ldap:show-remnants shows which users are not available on LDAP anymore, but have remnants in Nextcloud.
ldap:test-config tests an LDAP configuration
I've seen NC error out with “internet server error” messages due to changing the LDAP port on one of the configured server. To change the port back use the following command
sudo -u www-data php occ ldap:set-config s01 ldapPort 636