Lost pihole interface when installed nextcloud

Have you tried either of the following URL's:

http://pi.hole:8080/admin

http://192.168.4.40:8080/admin

From your debug log. The method you are using to change the lighttpd port is not sticky - it will be overwritten on the next Pi-hole update or repair.

-rw-r--r-- 1 root root 4113 Aug 15 00:59 /etc/lighttpd/lighttpd.conf
   server.modules = (
       "mod_access",
       "mod_auth",
       "mod_expire",
       "mod_fastcgi",
       "mod_accesslog",
       "mod_compress",
       "mod_redirect",
       "mod_setenv",
       "mod_rewrite"
   )
   server.document-root        = "/var/www/html"
   server.error-handler-404    = "/pihole/index.php"
   server.upload-dirs          = ( "/var/cache/lighttpd/uploads" )
   server.errorlog             = "/var/log/lighttpd/error.log"
   server.pid-file             = "/run/lighttpd.pid"
   server.username             = "lighttpd"
   server.groupname            = "lighttpd"
   server.port                 = 8080
   ...

For a more permanent port change, see the following: