Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Deploy Nextcloud Through Docker (Again)

Docker Compose File

services:
  nextcloud:
    container_name: nextcloud
    image: nextcloud:29.0.4-apache
    restart: always
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - nextcloud:/var/www/html
    depends_on:
        - db
    environment:
      - NEXTCLOUD_ADMIN_USER
      - NEXTCLOUD_ADMIN_PASSWORD
      - MYSQL_HOST=db
      - MYSQL_DATABASE=${MARIADB_DATABASE}
      - MYSQL_USER=${MARIADB_USER}
      - MYSQL_PASSWORD=${MARIADB_PASSWORD}
      - NEXTCLOUD_DATA_DIR=/var/www/html/data
      #- TRUSTED_PROXIES=172.20.50.0/24
      - NEXTCLOUD_TRUSTED_DOMAINS=nextcloud.home.programster.org

  db:
    image: mariadb:10.6
    container_name: db
    restart: always
    volumes:
      - db:/var/lib/mysql
    environment:
      - MARIADB_ROOT_PASSWORD
      - MARIADB_USER
      - MARIADB_PASSWORD
      - MARIADB_DATABASE


volumes:
  nextcloud:
    driver: local
  db:
    driver: local

Env File

COMPOSE_PROJECT_NAME=nextcloud

NEXTCLOUD_ADMIN_USER=programster

NEXTCLOUD_ADMIN_PASSWORD=""

MARIADB_DATABASE=nextcloud
MARIADB_USER=nextcloud
MARIADB_PASSWORD=""


MARIADB_ROOT_PASSWORD=""

Reverse Proxy

After having been deployed I wanted to set up reverse proxying for TLS certificates. Unfortunately, once this was in place there were issues around the site with it still using "http" instead of "https" in certain areas. This was resolved by opening the config.php file and adding the following to it:

'overwriteprotocol' => 'https',

For me, this file was located at:

/var/lib/docker/volumes/nextcloud_nextcloud/_data/config/config.php

Files not encrypted on server by default

https://docs.nextcloud.com/server/19/user_manual/files/encrypting_files.html

Desktop App

Is an "AppImage"

https://nextcloud.com/install/

References

  • https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/reverse_proxy_configuration.html
  • https://serverfault.com/questions/768693/nginx-how-to-completely-disable-request-body-buffering
Last updated: 25th July 2024
First published: 25th July 2024

This blog is created by Stuart Page

I'm a freelance web developer and technology consultant based in Surrey, UK, with over 10 years experience in web development, DevOps, Linux Administration, and IT solutions.

Need support with your infrastructure or web services?

Get in touch