Ursprüngliche Idee: IONOS - Nextcloud-Installation mit Docker
Nextcloud benötigt zur Funktion eine Datenbank und einen Webserver als Frontend, daher benötigen wir folgende Dienste:
| Dienst | Software | Dokumentation |
|---|---|---|
| Datenbank | MariaDB | https://mariadb.com/kb/en/documentation/ |
| Webserver | Nginx Proxy Manager | https://nginxproxymanager.com/ |
| Applikation | Nextcloud | https://docs.nextcloud.com/server/latest/admin_manual/ |
Baustelle
su - docker mkdir -p ~/projects/nextcloud-apache/ cd ~/projects/nextcloud-apache/
nano .env
# MariaDB MYSQL_ROOT_PASSWORD=<MariaDB Root Passwort> MYSQL_DATABASE=nextcloud MYSQL_USER=nc-dbuser MYSQL_PASSWORD=<Nextcloud DB-User Passwort> # Nextcloud VIRTUAL_HOST=<your.domain></your.domain> LETSENCRYPT_HOST=<your.domain></your.domain> LETSENCRYPT_EMAIL=<your@email></your@email>
nano docker-compose.yaml
networks:
network:
services:
app:
image: nextcloud:latest
container_name: nextcloud-apache-app
depends_on:
- mariadb
environment:
- VIRTUAL_HOST
- LETSENCRYPT_HOST
- LETSENCRYPT_EMAIL
networks:
- network
restart: always
volumes:
- app:/var/www/nextcloud
- data:/var/nextcloud-data
- /etc/localtime:/etc/localtime:ro
mariadb:
image: mariadb:10.11
container_name: nextcloud-apache-mariadb
environment:
- MYSQL_ROOT_PASSWORD
- MYSQL_DATABASE
- MYSQL_USER
- MYSQL_PASSWORD
hostname: mariadb
networks:
- network
ports:
- 3306:3306
restart: always
volumes:
- mariadb:/var/lib/mysql
- /etc/localtime:/etc/localtime:ro
npm:
image: jc21/nginx-proxy-manager:latest
container_name: nextcloud-apache-npm
environment:
DISABLE_IPV6: 'true'
networks:
- network
ports:
- '80:80' # Public HTTP Port
- '81:81' # Admin Web Port
- '443:443' # Public HTTPS Port
restart: always
volumes:
- npm:/data
- ./letsencrypt:/etc/letsencrypt
volumes:
app:
data:
mariadb:
npm:
docker compose up -d
Funktionstest
# Den mysql Client installieren # sudo apt install mysql # # Zur MariaDB als root verbinden (Passwort steht in der .env Datei) mysql -h 127.0.0.1 -u root -p # # Datenbanken anzeigen: Es muss u.a. die Database nextcloud erscheinen SHOW DATABASES; # # Benutzer auflisten: Es muss u.a. der Benutzer nc-dbuser erscheinen SELECT User, Host FROM mysql.user; # quit; # Zur MariaDB als nc-dbuser verbinden (Passwort steht in der .env Datei) mysql -h 127.0.0.1 -u nc-dbuser -p # quit;
client_body_buffer_size 512k;
proxy_read_timeout 86400s;
client_max_body_size 0;
location ^~ /.well-known {
# The rules in this block are an adaptation of the rules
# in `.htaccess` that concern `/.well-known`.
location = /.well-known/carddav { return 301 /remote.php/dav/; }
location = /.well-known/caldav { return 301 /remote.php/dav/; }
location /.well-known/acme-challenge { try_files $uri $uri/ =404; }
location /.well-known/pki-validation { try_files $uri $uri/ =404; }
# Let Nextcloud's API for `/.well-known` URIs handle all other
# requests by passing them to the front-end controller.
return 301 /index.php$request_uri;
}
Datenverzeichnis vorbereiten
# In den Container verbinden docker exec -it nextcloud-apache-app /bin/bash # Datenverzeichnis für den Benutzer www-data (uid 33) beschreibbar machen chown 33:33 /var/nextcloud-data/ chmod 770 /var/nextcloud-data/ # exit
(Einrichtung unter http://localhost:8080 - wird noch geändert wenn NPM fertig ist)