Skip to content

Configure Nextcloud snap

scubamuc edited this page Mar 9, 2024 · 82 revisions

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 using Lets Encrypt, or self-signed certificates. Run nextcloud.enable-https -h for more information.

Enable Lets Encrypt in Nextcloud snap:

sudo nextcloud.enable-https lets-encrypt

Enter email address and domain/subdomain to get your SSL certificate

See managing encryption


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:

sudo snap connect nextcloud:removable-media

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, especially when connecting an external USB-device.

Tip: Recommend creating a dedicated directory in /media/MYDIRECTORY/ or /mnt/MYDIRECTORY/ instead of "automount" /media/$USER/DEVICE/ directory and mounting the dedicated directory in /etc/fstab.

Removable media must be mounted to either /media or /mnt as root with root permissions and connected to 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:

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

Cron interval configuration

Note that Nextcloud snap includes a service that runs cron.php every 15 minutes, which will automatically change the cron admin setting to cron for you. By default the cron interval is 15 minutes.

To adjust it (e.g. 10 minutes) simply run:

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

If you want to disable the cron completely, run:

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

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

See managing cron


HTTP compression configuration

By default, the snap does not enable HTTP compression. 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_poxies 0 --value="your.reverse.proxy.ip"
sudo nextcloud.occ config:system:set trusted_poxies 1 --value="your.other.proxy.ip"
sudo nextcloud.occ config:system:set trusted_poxies 2 --value="another.reverse.proxy.ip"

See setting trusted proxies


Built-in CODE Server and Nextcloud office configuration

See configure Collabora Online - Built-in CODE Server and Nextcloud office on Nextcloud snap


Configuration options

Further options

Clone this wiki locally