All of the problems you’re having seem unrelated to Nextcloud itself. These are really more general Linux questions.
I wrote a guide for a Docker based setup on Ubuntu. It would probably work similarly on Debian. You can use it for a reference too if you need any extra examples.