Install Nextcloud in docker with mariadb, redis, cron and caddy.
-
Enter the folder
caddy/certs
-
Create a self signed certificate with this command
openssl req -newkey rsa:4096 -x509 -sha512 -days 365 -nodes -out certificate.pem -keyout privatekey.pem
-
Set the port you want to use to access Nextcloud (in this example the port is 1201)
In the
docker-compose.yml
fileports: - 1201:1201
and in the
caddy/Caddyfile
:1201 tls /etc/caddy/certificate.pem /etc/caddy/privatekey.pem reverse_proxy nextcloud:80
-
Set the database and redis passwords
-
Change the memory limits to something that suits your needs
mem_limit: "256M"
-
Set the local folder you want to use for the Nextcloud data (both in nextcloud and in cron)
- /mnt/Volume/nextcloud/:/var/www/html/data
-
Set the domain name from which you'll access nextcloud (if you are using a service like dynds add
dyndns.org
or the domain you are using)- NEXTCLOUD_TRUSTED_DOMAINS=$YOUR_DOMAIN$
If you want to access Nextcloud only from localhost you can remove the line.
Use this command to create and start all the containers
docker compose up -d
To run occ commands
docker exec -ti --user www-data nextcloud /var/www/html/occ COMMAND
To update Nextcloud to the most recent version:
docker compose down
docker compose pull nextcloud
docker compose up -d