Skip to content

Instantly share code, notes, and snippets.

@simon04
Last active January 11, 2022 07:44
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simon04/e493a1f086549b0268d412a9e3ed2669 to your computer and use it in GitHub Desktop.
Save simon04/e493a1f086549b0268d412a9e3ed2669 to your computer and use it in GitHub Desktop.
Nextcloud via Docker and Caddy

This runs Nextcloud as Docker container (using the fpm image) and serves it via Caddy

systemctl --user daemon-reload
systemctl --user start docker-nextcloud.service
sudo systemctl start caddy.service

Run the following command via the host cron for Nextcloud's background jobs (neither AJAX nor Webcron fetch RSS feeds for Nextcloud news):

docker exec --user www-data nextcloud-systemd php /var/www/html/cron.php

To update Nextcloud, run docker pull nextcloud:fpm followed by systemctl --user restart docker-nextcloud.service.

# /etc/caddy/Caddyfile
cloud.example.com {
root /srv/http/nextcloud/
fastcgi / localhost:7070 php {
root /var/www/html/
}
timeouts 30m
}
# .config/systemd/user/docker-nextcloud.service
[Unit]
Description=Docker Nextcloud
[Service]
Restart=always
ExecStart=/usr/bin/docker run \
--name=nextcloud-systemd \
--rm \
-p 7070:9000 \
-v /srv/http/nextcloud:/var/www/html \
-v /home/simon/nextCloud.d/config:/var/www/html/config \
-v /home/simon/nextCloud.d/data:/var/www/html/data \
-v /home/simon/Fotos:/Fotos \
nextcloud:fpm
[Install]
WantedBy=default.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment