Application Guides

How can we help?

Guides and technical documentation for your Server4You dedicated server or VPS.

Nextcloud Logo

Install Nextcloud with Docker

This guide shows how to install Nextcloud, the open-source platform for your own cloud with files, calendars and contacts, with MariaDB via Docker Compose on your Linux server. It covers the Compose file, the web setup and HTTPS access via a reverse proxy.

Prerequisites:
✓ A server running a current Linux distribution (e.g. Ubuntu 24.04 or Debian 13)
✓ Docker and Docker Compose installed on the server
✓ A domain name pointing to your server's IP address (recommended for SSL)

Step 1: Create the Docker Compose File

Log in to your server via SSH, create a directory for Nextcloud, and open the Compose file:

Create Directory and File
mkdir nextcloud && cd nextcloud && nano docker-compose.yml

Paste the following content into the file. Replace the password placeholders with your own secure values — more on this in Step 2.

docker-compose.yml
services: db: image: mariadb:11.4 restart: always command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW volumes: - ./db:/var/lib/mysql environment: - MYSQL_ROOT_PASSWORD=YOUR_STRONG_ROOT_PASSWORD - MYSQL_PASSWORD=YOUR_STRONG_MYSQL_PASSWORD - MYSQL_DATABASE=nextcloud - MYSQL_USER=nextcloud app: image: nextcloud:latest restart: always ports: - 8080:80 depends_on: - db volumes: - ./nextcloud:/var/www/html environment: - MYSQL_PASSWORD=YOUR_STRONG_MYSQL_PASSWORD - MYSQL_DATABASE=nextcloud - MYSQL_USER=nextcloud - MYSQL_HOST=db

Step 2: Set Your Passwords

Before proceeding, replace both placeholders in the file with your own secure passwords:

PlaceholderDescription
YOUR_STRONG_ROOT_PASSWORDRoot password for MariaDB — used internally only
YOUR_STRONG_MYSQL_PASSWORDPassword for the Nextcloud database user — must be identical in both db and app

Step 3: Start the Stack

Start the entire Nextcloud stack with a single command. Docker will pull the required images and start all containers in the background.

Start Docker Compose
docker compose up -d

The -d flag stands for "detached mode" — the containers run in the background without blocking your terminal session.

Step 4: Complete Setup in the Browser

Once the containers are running, Nextcloud is accessible in your browser. Open:

http://YOUR_SERVER_IP:8080

1.Create your administrator account by choosing a username and password
2.Under Storage & Database, select MySQL/MariaDB
3.Fill in the database fields with the following values:
FieldValue
Database usernextcloud
Database passwordYOUR_STRONG_MYSQL_PASSWORD
Database namenextcloud
Database hostdb

Click Finish setup. After a few moments you will be logged in to your new Nextcloud instance.

Step 5: Set Up a Reverse Proxy for HTTPS (Recommended)

For a production-ready setup, you should not access Nextcloud permanently via IP address and port 8080. A reverse proxy routes traffic from your domain and enables HTTPS encryption — allowing you to reach Nextcloud securely via an address like https://cloud.yourdomain.com.

Common tools for this are Nginx Proxy Manager, Traefik, or Caddy. All three can also run as Docker containers and integrate well with this setup.

Further Documentation

For detailed configuration options and advanced setup scenarios, we recommend the official Nextcloud documentation.