Category: nextcloud

Enable HTTPS for NextCloud Docker using `docker-compose`

Enable HTTPS for NextCloud Docker using docker-compose

By default, NextCloud Docker doesn't enable HTTPS.

Steps

Create

  • Create folders
    • /app/nextcloud/data/db: for MySQL database
    • /app/nextcloud/data/db_conf: for MySQL database configuration (don't see anything in it)
    • /app/nextcloud/data/cert: for nextcloud certificates
    • /app/nextcloud/data/html: for nextcloud data and packages
  • Create docker-compose.yml
  • Create Dockerfile.nextcloud
  • Run docker-compose build
  • Run docker-compose up -d

Destroy

  • Run docker-compose down

Docker Compose

docker-compose.yml:

version: '3'

services:
  db:
    image: mariadb:latest
    restart: always
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    volumes:
      - /app/nextcloud/data/db:/var/lib/mysql
      - /app/nextcloud/data/db_conf:/etc/mysql/conf.d
    environment:
      - MYSQL_ROOT_PASSWORD=<mysql_root_password>
      - MYSQL_PASSWORD=<mysql_user_password>
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud

  app:
    build:
      context: .
      dockerfile: Dockerfile.nextcloud
    restart: always
    ports:
      - 80:80
      - 443:443
    links:
      - db
    volumes:
      - /app/nextcloud/data/html:/var/www/html
      - /app/nextcloud/data/cert/fullchain.pem:/etc/ssl/certs/ssl-cert-snakeoil.pem
      - /app/nextcloud/data/cert/privkey.pem:/etc/ssl/private/ssl-cert-snakeoil.key
    environment:
      - MYSQL_PASSWORD=<mysql_user_password>
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_HOST=db

Dockerfile.nextcloud

  • Define base docker image as nextcloud:latest
  • Enable ssl module
  • Enable default-ssl site
FROM nextcloud:latest

RUN a2enmod ssl
RUN a2ensite default-ssl

References

Unable to login after set admin password when setting up NextCloud

Unable to login after set admin password when setting up

After installed NextCloud using NextCloud Docker, unable to login using newly created admin password.

Solution

Use Google Chrome to login, it doesn't work in Firefox and Microsoft Edge. After fully completed setup, Firefox works again.

Update NextCloudPi

Update NextCloudPi

If go thru NextCloudPI WebUI to update NextCloudPi or NextCloud running by NextCloudPi in Docker, errors could be occurred, which can lead the user not found error. The correct way to do is recreate container using new image.

Note: /data in container must be mapped or backed up.

Update NextCloudPI Image

docker image pull ownyourbits/nextcloudpi-x86

Remove existing container

docker stop nextcloudpi
docker rm nextcloudpi

Recreate container

Use the previous docker parameter, make sure /data was mapped.

docker run -d -p 4443:4443 -p 443:443 -p 80:80 -v /app/nc/data:/data --name nextcloudpi ownyourbits/nextcloudpi-x86 $IP

Update NextCloudPi

Login to NextCloudPi, the NextCloudPi will update itself, need to wait for the process pigz completed.

Restore data from backup (If required)

Go to Backup => nc-backup-auto in NextCloudPi WebUI, to find out the backup path, and restore the latest if required.

Manual Update NextCloud

Go to Updates => nc-update-nextcloud in NextCloudPi WebUI, to update NextCloud Manually.

Unable to show login page for NextCloud

Unable to show login page for NextCloud

NextCloud shows Internal Server Error on first page.

Error

In docker log, shows following message

Class 'OCP\\User' not found

and it points to following file

/data/nextcloud/apps/epubreader/lib/Hooks.php

Warning before

There was an warning message pointing to epubreader app, shows untruested source, but after I reinstalled it, the message disappered.

Fix

Access docker

docker exec -it nextcloudpi bash

Move the epubreader app to /tmp directory.

mv /data/nextcloud/apps/epubreader/ /tmp/

Restart NextCloudPi docker container

Next

After fixed, if try to install EPUB/CBZ/PDF ebook reader app again, following message appears.

Error: This app cannot be enabled because it makes the server unstable

If force install it, NextCloud will appear Internal Server Error again.

NextCloud missing .ocdata error

NextCloud missing .ocdata error

After run NextCloudPi many days, got following message

Your data directory is invalid
Ensure there is a file called ".ocdata" in the root of the data directory.

Fix

Go to nextcloud/data, create an empty file

cd nexcloud/data
touch .ocdata

But I don't know why it was missing.

References

Nextcloud problem: missing .ocdata file [solution]

NextCloud menu display incorrectly

NextCloud menu display incorrectly

A strange error happens in some browsers, NextCloud menu become a big page vertically, and one password textbox there requesting password, but the password is not working.

Not specific OS or browser

In my iMac, Safari is not working. In my one Windows machine, Firefox is not working. By the way, the Firefox has sync enabled and it is working in another PC. Google Chrome and Microsoft Edge have no issue.

Debugging

There is programming error, the contents were downloaded from following website directly, not the NextCloud server. Browser blocked them.

https://raw.githubusercontent.com

Solution

Disable "Theming App" in NextCloud Apps screen.

References

NextCloud page not displaying correctly

Install App in NextCloud Manually

Install App in NextCloud Manually

Got issue to see AppStore in NextCloud, could not fix it.

Tried, but failed

Set appstore in config.php

Updated config.php with following options, but failed.

'appstoreenabled' => true,
'appstoreurl' => 'https://apps.nextcloud.com/api/v1',

But successfully using curl tested access to https://apps.nextcloud.com/api/v1.

Using occ

php occ app:list

Can not see Apps in AppStore

Manual installation

  • Download App from app.nextcloud.com, extract to nextcloud/apps folder.

  • Change owner to www-data:www-data

  • Go to GUI Apps => Disabled apps, refresh page

  • Then the app should be listed.

  • Click on install to install it.

References

Apps management
Using the occ command

Fix NextCloudPi Security & setup warnings

Fix NextCloudPi Security & setup warnings

Following warnings appear by default:

  • No default_phone_region configured
  • Imagick missing in PHP

Missing default_phone_region

Add following line in nextcloud/config/config.php:

...
  'default_phone_region' => 'SG',
}

Restart NextCloudPi.

Imagick missing in PHP

Install php-imagick package:

# docker exec -it nextcloudpi bash
# apt install php-imagick

Restart NextCloudPi.

Then new issue

Got following warning

Module php-imagick in this instance has no SVG support. For better compatibility it is recommended to install it.

Then run following commands

# docker exec -it nextcloudpi bash
# apt-get install libmagickcore-6.q16-6-extra

Restart NextCloudPi

References

Configuration Parameters
Imagick missing - version php 7.3
How to enable SVG for php-imagick

NextCloud password manager – Passwords

NextCloud password manager - Passwords

NextCloud password manager, Passwords is an add-on feature of NextCloud, it can be used to save passwords.

Support

It supports Firefox, Chrome, but not Safari. It also supports iOS and Android.

It doesn\'t support OS, such as SSH.

Interface

The interface is too complex compare with other system default password saving features, not user friendly.

Pros

Have notes for password, which allows saving more info.

References

Password managers for Nextcloud