Basic snap/nginx installation question on Debian

Hi, new here. I’m trying to install Nextcloud on my Debian 12 server, which has several services and webpages already running under nginx.

I followed the instructions for an installation via snap, and then proceeded to apply the community-maintained official instructions for nginx setup on this page.

Nextcloud is properly installed but Apache won’t run because of nginx, which is fine if I can avoid running a second server alongside nginx. This is what is output by snap services nextcloud:

Service                    Startup  Current   Notes
nextcloud.apache           enabled  inactive  -
nextcloud.logrotate        enabled  inactive  timer-activated
nextcloud.mysql            enabled  active    -
nextcloud.nextcloud-cron   enabled  active    -
nextcloud.nextcloud-fixer  enabled  active    -
nextcloud.php-fpm          enabled  active    -
nextcloud.redis-server     enabled  active    -
nextcloud.renew-certs      enabled  active    -

I adapted my nginx config file with my domain and php-fpm address, issued and added SSL certificates with Certbot, but I have trouble understanding how it all fits together.

Nextcloud is installed in /snap/nextcloud/. I saw there were some php files in htdocs so I set the nginx root directive as follows:

root /snap/nextcloud/current/htdocs;

When I try to access the server with I get the following message in the browser:

App directory “/htdocs/apps” not found! Please put the Nextcloud apps folder in the Nextcloud folder. You can also configure the location in the config.php file.

There is definitely an /apps directory inside htdocs, I’ve checked. I don’t want to touch config.php unless I have to, for fear of breaking something in a system I’m only just discovering.

Any help would be much appreciated. Thanks.

EDIT: I tried editing config.php and couldn’t (“Read-only file system”). I’ve also created an admin user with sudo /snap/bin/nextcloud.manual-install my-name my-password and added my domain to the trusted list with sudo /snap/bin/nextcloud.occ config:system:set trusted_domains 1 --value= All the above works, but I still can’t access the web interface.