Nextcloud encountered an internal error while configuring memcache

Check your Nextcloud log, as suggested in the internal server error message (as well as the support template sections you appear to have deleted). It will have the specifics.

Failing that, please provide the actual parsed config by running occ config:list system, as noted in the support template.