How to configure Nextcloud snap

Nextcloud snap configuration

HTTPS encryption with Lets Encrypt

The only thing we recommend you do up front is enable HTTPS. Nextcloud snap includes a service for automated HTTPS encryption and automated renewal using Lets Encrypt or self-signed certificates. Run nextcloud.enable-https -h for more information.

Enable Lets Encrypt in Nextcloud snap:

  • issue command in host shell
sudo nextcloud.enable-https lets-encrypt

TIP

Read the resulting response carefully and ensure the requirements are met.

grafik

Enter valid email address and domain/subdomain.
If you need to setup multiple domains then separate the domains/subdomains with a space.

IMPORTANT

Let’s Encrypt will expect that Nextcloud is exposed on ports 80 and 443. If you change ports and don’t put Nextcloud behind a reverse proxy such that ports 80 and 443 are sent to Nextcloud for that domain name, Let’s Encrypt will be unable to verify ownership of your domain and will not grant certificates.

Self-signed certificate is easier to setup than Let’s Encrypt certificates, but will cause warnings in browsers and due to being very basic won’t work with some applications.


Removable media

The interface providing the ability to access removable media is not automatically connected upon install, so if you’d like to use external storage (or otherwise use a device in /media or /mnt for data), you need to give the snap permission to access removable media by connecting that interface:

  • issue command in host shell
sudo snap connect nextcloud:removable-media

NOTE

Removable media can be any device (e.g. external-disk-partition, NFS-network mount, SSHFS-network mount etc.).
The device should be available at system boot and mounted by /etc/fstab.

TIP

Ensure USB-boot is disabled in BIOS or use the --nofail option in /etc/fstab for headless boot (i.e. server install), especially when connecting an external USB-device.

TIP

Create a dedicated directory in /media/MYDIRECTORY/ or /mnt/MYDIRECTORY/ mounting the dedicated directory in /etc/fstab instead of Ubuntu’s “automount” /media/$USER/DEVICE/ directory.

MPORTANT

Removable media must be mounted to either /media or /mnt as root with root permissions and connected to Snap!

Managing external media and storage for Nextcloud snap


System monitoring

The System application requires a bit more access to the system than the snap uses by default (e.g. the ability to monitor network hardware, etc.). If you’d like to utilize those features, you’ll need to connect the interface that allows that kind of access:

  • issue command in host shell
sudo snap connect nextcloud:network-observe

PHP Memory limit configuration

By default, PHP will use 128M as the memory limit. If you notice images not
getting previews generated, or errors about memory exhaustion in your Nextcloud
log, you may need to set this to a higher value.

If you’d like to set the memory limit to a higher value (say, 512M), run:

sudo snap set nextcloud php.memory-limit=512M

To set it to be unlimited (not recommended), use -1:

sudo snap set nextcloud php.memory-limit=-1

Cronjob interval configuration

Nextcloud from 30.0.x recommends a 5 Minute cron interval:

By default the cronjob interval is 5 minutes.

first start

To adjust it (to 5 minutes) simply run:

$ sudo snap set nextcloud nextcloud.cron-interval=5m

To adjust it (to 10 minutes) run:

$ sudo snap set nextcloud nextcloud.cron-interval=10m

If you want to disable the cronjob completely, run:

$ sudo snap set nextcloud nextcloud.cron-interval=-1

To reenable it again simply set the nextcloud.cron-interval snap variable to a value that isn’t -1


HTTP compression configuration

By default, the snap does not enable HTTP compression. HTTP compression may improve site response where bandwidth and device resources are limited.

To enable it, run:

sudo snap set nextcloud http.compression=true

To disable it, run:

sudo snap set nextcloud http.compression=false

Trusted domains configuration

By default, Nextcloud snap will accept HTTP requests addressed to localhost from the server itself. But when you’re setting things up on a remote or virtual server (like an AWS EC2 instance) you’ll need to tell Nextcloud to expect remote browser requests made to your IP address or domain name. Note how you assign a separate ID number (iterating values 0, 1, 2…) for each domain. See multiple trusted domains for config.php configuration options

Set trusted domains (iterating values 0, 1, 2…):

sudo nextcloud.occ config:system:set trusted_domains 0 --value="cloud.yourdomain.com"
sudo nextcloud.occ config:system:set trusted_domains 1 --value="cloud.yourseconddomain.com"
sudo nextcloud.occ config:system:set trusted_domains 2 --value="cloud.yourotherdomain.com"

See setting trusted domains.


Trusted proxy configuration

When you’re running Nextcloud snap behind a proxy the snap needs to know about the proxy. Add reverse proxy to trusted proxies. See Nextcloud reverse proxy documentation.

Set trusted proxies (iterating values 0, 1, 2…):

sudo nextcloud.occ config:system:set trusted_proxies 0 --value="your.reverse.proxy.ip"
sudo nextcloud.occ config:system:set trusted_proxies 1 --value="your.other.proxy.ip"
sudo nextcloud.occ config:system:set trusted_proxies 2 --value="another.reverse.proxy.ip"

See setting trusted proxies


Configuration options

Nextcloud snap wiki & support

4 Likes
How to install Nextcloud snap
How to manage setup warnings in Nextcloud snap
How-to/FAQ WIKI
Moving NC to a new machine - advice needed
Cannot modify shared Nextcloud calendar in Thunderbird
Location of Nextcloud config files
Nextcloud Snap server stops working after installing custom SSL certificate from GoDaddy
Let nextcloud listen on one IP address only
Cookbook and reverse proxy
Limiting RAM Use
Nextcloud (Snap) 0770 Permission Denied on rclone Google Drive Mount (chown has no effect)
Unable to see added storage of 2TB hdd within System disk free space.
Photos tab groups a JST JPEG under the next month despite EXIF OffsetTimeOriginal=+09:00 — known issue?
Cannot login with correct password and no error message
Snap updated to 32.0.9snap1 and encountering internal server error, reverting does not fix.
How to change SNAP_DATA
Snap: Can't update, add, or remove apps
temporary 2fa code generated by 2fa admin tools not accepted when client uses it
Nextcloud Snap with Collabora Online - Android problems
No Log file rotation even when set, logs excessive size crashed server
Nextcloud Snap Ai message in overwiev
On Core24 with NC31 and after a snap restore: Missing nextcloud.log
Delete spreed signaling server account on Nextcloud Snap
Untrusted Domain message on my Cell phone running tailscale
How to manage security brute force protection and throttling in Nextcloud snap
Let's Encrypt Zertifikat abgelaufen
Transitioning from plain installation to containerized (eg snap)
Nextcloud snap, welcome - missing support template
Nextcloud URL is missing scheme or host
Using Acme/LetsEncrypt for TLS Certificate for NextCloud and for VPN on Firewall
Self-Hosted Nextcloud, Data Directory to SSD Error
Internal server error: "no app in context"
How to install ssl non certbot non let's encrypt
always use HTTPS on production servers - where is the Apache VirtualHosts configuration file
Unable to log in and not able to understand the log in nextcloud/data/
Calendar app on Android does not sync with NextCloud anymore
Which config.php is the right one and how to add trusted domains correctly
INVALID_HASH of Collabora_Online.AppImage
Nextcloud SNAP install suddenly satuats WAN on connection to github
Error in Desktop Notifications for Nextcloud Progressive Web App instance
MySql crashes on startup - Snap installation
Android Nextcloud app upload errors