Requesting Assistance for Enabling HTTPS on Nextcloud Installed on CasaOS

Dear Icewhale Forum Members,

I hope this message finds you well. I am seeking guidance regarding the installation of Nextcloud on CasaOS. I have encountered an issue where Nextcloud displays a warning indicating that I am not using HTTPS, consequently restricting access to certain functionalities.

I have successfully installed Nextcloud on my system but require assistance in enabling HTTPS to ensure secure communication. I am unfamiliar with the necessary steps to configure HTTPS within CasaOS or specifically for Nextcloud.

Could anyone provide detailed instructions or guidance on how to set up HTTPS for Nextcloud on CasaOS? I understand the importance of secure connections and would greatly appreciate any help or advice you could offer to resolve this issue.

Thank you very much for your time and assistance.

Best regards,

1 Like

Thank you for reaching out regarding setting up HTTPS for Nextcloud on CasaOS. Here are the steps to enable secure connections:

Install an SSL certificate. You can use a free one like Let’s Encrypt or purchase a commercial certificate.
Place the certificate files (fullchain.pem and privkey.pem typically) in the Nextcloud app data directory, e.g. /var/lib/apps/nextcloud/https
Edit the Nextcloud config file at /var/lib/apps/nextcloud/config/config.php. Set ‘overwriteprotocol’ to ‘https’ and update the paths to your certificate files.
For example:

‘overwriteprotocol’ => ‘https’,

‘ssl_method’ => ‘letsencrypt’,

‘ssl_certificate’ => ‘/var/lib/apps/nextcloud/https/fullchain.pem’,

‘ssl_certificate_key’ => ‘/var/lib/apps/nextcloud/https/privkey.pem’,

Restart the Nextcloud app service for changes to take effect.
I hope these steps help you in setting up HTTPS access for Nextcloud on CasaOS. Secure connections are important for privacy and functionality. Let me know if you have any other questions!

1 Like

Hi, im trying the same thing but cant get it to work.

I installed nextcloud from the AppStoe on CasaOS. I got the certificates from Let’s Encrypt and placed them in /DATA/AppData/nextcloud/var/fullchain.pem and /DATA/AppData/nextcloud/var/privkey.pem.

this is how my nextcloud.yaml looks:

version: '3.7'
services:
  nextcloud:
    cpu_shares: 90
    command: []
    container_name: nextcloud
    deploy:
      resources:
        limits:
          memory: 7848M
        reservations:
          memory: "536870912"
    hostname: nextcloud
    image: nextcloud:29.0.0
    labels:
      icon: https://cdn.jsdelivr.net/gh/IceWhaleTech/CasaOS-AppStore@main/Apps/Nextcloud/icon.png
    ports:
      - target: 80
        published: 80
        protocol: tcp
      - target: 443
        published: 443
        protocol: tcp
    restart: unless-stopped
    volumes:
      - type: bind
        source: /DATA/AppData/nextcloud/var/www/html
        target: /var/www/html
      - type: bind
        source: /DATA/AppData/nextcloud/var/fullchain.pem
        target: /var/lib/apps/nextcloud/https/fullchain.pem
        read_only: true
      - type: bind
        source: /DATA/AppData/nextcloud/var/privkey.pem
        target: /var/lib/apps/nextcloud/https/privkey.pem
        read_only: true
    environment:
      - NEXTCLOUD_OVERWRITEPROTOCOL=https
      - NEXTCLOUD_SSL_CERTIFICATE=/var/lib/apps/nextcloud/https/fullchain.pem
      - NEXTCLOUD_SSL_CERTIFICATE_KEY=/var/lib/apps/nextcloud/https/privkey.pem
    network_mode: bridge
    privileged: false
x-casaos:
  architectures:
    - amd64
    - arm
    - arm64
    - "386"
    - mips64le
    - ppc64le
    - s390x
  author: CasaOS Team
  category: Cloud
  description:
    ar_sa: يضع Nextcloud بياناتك في أصابعك، تحت سيطرتك. احفظ مستنداتك والتقويم وجهات
      الاتصال والصور على خادم في المنزل أو في أحد مزودينا أو في مركز بيانات تثق
      به.
    de_de: Nextcloud stellt Ihre Daten in Ihren Händen, unter Ihrer Kontrolle.
      Speichern Sie Ihre Dokumente, Kalender, Kontakte und Fotos auf einem
      Server zu Hause, bei einem unserer Anbieter oder in einem von Ihnen
      vertrauten Datenzentrum.
    en_us: Nextcloud puts your data at your fingertips, under your control. Store
      your documents, calendar, contacts and photos on a server at home, at one
      of our providers or in a data center you trust.
    es_es: Nextcloud pone sus datos a su alcance, bajo su control. Almacene sus
      documentos, calendario, contactos y fotos en un servidor en casa, en uno
      de nuestros proveedores o en un centro de datos que confíe.
    fr_fr: Nextcloud met vos données à votre portée, sous votre contrôle. Stockez
      vos documents, calendriers, contacts et photos sur un serveur à la maison,
      chez l'un de nos fournisseurs ou dans un centre de données que vous pouvez
      faire confiance.
    hu_hu: A Nextcloud adatait a saját kezében tartja, saját irányítása alatt.
      Tárolja dokumentumait, naptárát, kapcsolatait és fényképeit otthoni
      szerverén, szolgáltatóink egyikén vagy megbízható adatközpontjában.
    it_it: Nextcloud mette i tuoi dati a portata di mano, sotto il tuo controllo.
      Memorizza i tuoi documenti, calendario, contatti e foto su un server in
      casa tua, su uno dei nostri fornitori o in un data center che ti fidi.
    pl_pl: Nextcloud umożliwia przechowywanie danych w Twoim domu, w Twoim zakresie
      kontroli. Przechowuj dokumenty, kalendarz, kontakty i zdjęcia na serwerze
      w domu, u jednego z naszych dostawców lub w zaufanym centrum danych.
    pt_br: O Nextcloud coloca seus dados nas suas mãos, sob o seu controle. Armazene
      seus documentos, calendário, contatos e fotos em um servidor em casa, em
      um de nossos provedores ou em um centro de dados que você confia.
    ru_ru: Nextcloud помещает ваши данные под вашим контролем. Храните свои
      документы, календарь, контакты и фотографии на сервере дома, у одного из
      наших поставщиков или в доверенном вам центре данных.
    sv_se: Nextcloud ger dig kontroll över dina data. Lagra dina dokument, kalender,
      kontakter och foton på en server hemma, hos en av våra leverantörer eller
      i ett datacenter du litar på.
    uk_ua: Nextcloud розташовує ваші дані під вашим контролем. Зберігайте свої
      документи, календар, контакти та фотографії на сервері вдома, у одного з
      наших постачальників або у довіреному центрі даних.
    zh_cn: Nextcloud 将您的数据放在您的掌握之中。将您的文档、日历、联系人和照片存储在您信任的家庭服务器、我们的提供商或数据中心中。
  developer: Nextcloud
  hostname: ""
  icon: https://cdn.jsdelivr.net/gh/IceWhaleTech/CasaOS-AppStore@main/Apps/Nextcloud/icon.png
  index: /
  is_uncontrolled: false
  main: nextcloud
  port_map: "10081"
  scheme: http
  screenshot_link:
    - https://cdn.jsdelivr.net/gh/IceWhaleTech/CasaOS-AppStore@main/Apps/Nextcloud/screenshot-1.png
    - https://cdn.jsdelivr.net/gh/IceWhaleTech/CasaOS-AppStore@main/Apps/Nextcloud/screenshot-2.png
    - https://cdn.jsdelivr.net/gh/IceWhaleTech/CasaOS-AppStore@main/Apps/Nextcloud/screenshot-3.png
  store_app_id: nextcloud
  tagline:
    ar_sa: منصة الإنتاجية التي تبقيك تحت سيطرتك
    de_de: Die Produktivitätsplattform, die Sie unter Kontrolle hält
    en_us: The productivity platform that keeps you in control
    es_es: La plataforma de productividad que te mantiene en control
    fr_fr: La plate-forme de productivité qui vous permet de rester en contrôle
    hu_hu: A termelékenységi platform, amely megőrzi a kontrollot
    it_it: La piattaforma di produttività che ti mantiene in controllo
    pl_pl: Platforma produktywności, która utrzymuje cię w kontroli
    pt_br: A plataforma de produtividade que mantém você sob controle
    ru_ru: Платформа производительности, которая держит вас под контролем
    sv_se: Produktivitetsplattformen som håller dig i kontroll
    uk_ua: Платформа продуктивності, яка дозволяє вам залишатися під контролем
    zh_cn: 保持您控制的生产力平台
  thumbnail: https://cdn.jsdelivr.net/gh/IceWhaleTech/CasaOS-AppStore@main/Apps/Nextcloud/thumbnail.jpg
  tips: {}
  title:
    custom: ""
    en_us: Nextcloud

I also changed the config.php (mydomain.com is replaced with the actual domainname):

?php
$CONFIG = array (  
'overwriteprotocol' => 'https',
  'ssl_method' => 'letsencrypt',
  'ssl_certificate' => '/var/lib/apps/nextcloud/https/fullchain.pem',
  'ssl_certificate_key' => '/var/lib/apps/nextcloud/https/privkey.pem',
 'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 => 
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'upgrade.disable-web' => true,
  'instanceid' => 'xxxxxxxxx,
  'passwordsalt' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
  'secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
  'trusted_domains' => 
  array (
    0 => 'mydomain.com',
    1 => 'localhost',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'sqlite3',
  'version' => '29.0.0.19',
  'overwrite.cli.url' => 'https://mydomain.com,
  'installed' => true,
);

When i configure the WebUI to run on http with my domain and remove the addtional code from the config regarding the https and certificates, everthying works fine but only http.

what am i doing wrong?

Be sure that no other service is occupying port 443