# Not able to run nextcloud.enable-https lets-encrypt

**URL:** <https://help.nextcloud.com/t/not-able-to-run-nextcloud-enable-https-lets-encrypt/142168>\
**Category:** ℹ️ Support\
**Created:** [July 13, 2022, 6:06pm UTC](https://help.nextcloud.com/t/not-able-to-run-nextcloud-enable-https-lets-encrypt/142168 "2022-07-13T18:06:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeremy\_fritzen](https://help.nextcloud.com/user_avatar/help.nextcloud.com/jeremy_fritzen/32/18101_2.png) [@jeremy\_fritzen](https://help.nextcloud.com/u/jeremy_fritzen)\
**Post date:** [July 13, 2022, 6:06pm UTC](https://help.nextcloud.com/t/not-able-to-run-nextcloud-enable-https-lets-encrypt/142168/1 "2022-07-13T18:06:30Z")

</div>

Nextcloud version _(eg, 20.0.5)_: `24.0.1snap1 (installed via snap)`  
Operating system and version _(eg, Ubuntu 20.04)_: `Ubuntu 20.04 (LXC Container hosted on Proxmox)`  
Apache or nginx version _(eg, Apache 2.4.25)_: `don't know (installed via snap)`  
PHP version _(eg, 7.4)_: `don't know (installed via snap)`

The issue you are facing:  
`nextcloud.enable-https lets-encrypt` doesn’t seem to work (the commands keeps running but there is no output).

Is this the first time you’ve seen this error? _(Y/N)_: Y

Steps to replicate it:

1. Deploy LXC Container (Ubuntu)
2. Install nextcloud snap package
3. Install and configure nextcloud :
  - `nextcloud.manual-install <user> <password>`
  - `nextcloud.occ config:system:set trusted_domains 1 --value=<nextcloud IP>`=\> At this step, I’m able to log in on Nextcloud webpage. Everything seems to work (through HTTP though)
  - `nextcloud.enable-https lets-encrypt` =\> this command keeps running and nothing happens (no output, no error). i’m able to cancel the command (Ctrl+C).

The output of your Nextcloud log in **Admin \> Logging** :

```auto
{"reqId":"Y6ZrVLcOTR37bDCeqsKu","level":2,"time":"2022-07-13T14:26:18+00:00","remoteAddr":"192.168.1.42","user":"--","app":"core","method":"GET","url":"/","message":"Trusted domain error. \"192.168.1.42\" tried to access using \"192.168.1.63\" as host.","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36","version":"24.0.1.1"}
{"reqId":"ylDCQPhPejqJDeDp4fXV","level":2,"time":"2022-07-13T14:26:23+00:00","remoteAddr":"192.168.1.42","user":"--","app":"core","method":"GET","url":"/index.php/js/core/merged-template-prepend.js?v=83e9abba","message":"Trusted domain error. \"192.168.1.42\" tried to access using \"192.168.1.63\" as host.","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36","version":"24.0.1.1"}
{"reqId":"Ufsq0AuqDeFzBzXhtHWQ","level":2,"time":"2022-07-13T14:26:27+00:00","remoteAddr":"192.168.1.42","user":"--","app":"core","method":"GET","url":"/cron.php","message":"Trusted domain error. \"192.168.1.42\" tried to access using \"192.168.1.63\" as host.","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36","version":"24.0.1.1"}
{"reqId":"LI97MajkVw8kG69IInVK","level":2,"time":"2022-07-13T14:27:03+00:00","remoteAddr":"192.168.1.42","user":"--","app":"core","method":"GET","url":"/","message":"Trusted domain error. \"192.168.1.42\" tried to access using \"192.168.1.63\" as host.","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36","version":"24.0.1.1"}
{"reqId":"yApZJFgzZjHlFyBD3XbP","level":2,"time":"2022-07-13T14:27:06+00:00","remoteAddr":"192.168.1.42","user":"--","app":"core","method":"GET","url":"/index.php/js/core/merged-template-prepend.js?v=83e9abba","message":"Trusted domain error. \"192.168.1.42\" tried to access using \"192.168.1.63\" as host.","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36","version":"24.0.1.1"}
{"reqId":"XgAZkS5EvWAbs0Pr2DXG","level":2,"time":"2022-07-13T14:27:08+00:00","remoteAddr":"192.168.1.42","user":"--","app":"core","method":"GET","url":"/cron.php","message":"Trusted domain error. \"192.168.1.42\" tried to access using \"192.168.1.63\" as host.","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36","version":"24.0.1.1"}
{"reqId":"06obsJ27MdPr8uJMW2D6","level":2,"time":"2022-07-13T14:34:50+00:00","remoteAddr":"192.168.1.42","user":"--","app":"core","method":"GET","url":"/","message":"Trusted domain error. \"192.168.1.42\" tried to access using \"192.168.1.63\" as host.","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36","version":"24.0.1.1"}
{"reqId":"nPZB7MvGJpdApHrWUSaH","level":2,"time":"2022-07-13T14:34:55+00:00","remoteAddr":"192.168.1.42","user":"--","app":"core","method":"GET","url":"/index.php/js/core/merged-template-prepend.js?v=83e9abba","message":"Trusted domain error. \"192.168.1.42\" tried to access using \"192.168.1.63\" as host.","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36","version":"24.0.1.1"}
{"reqId":"XzW8q5dwEPSCxkiP1DIC","level":3,"time":"2022-07-13T14:40:09+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"Trying to access array offset on value of type null at /snap/nextcloud/31033/htdocs/apps/dav/lib/CalDAV/BirthdayService.php#306","userAgent":"--","version":"24.0.1.1","exception":{"Exception":"Error","Message":"Trying to access array offset on value of type null at /snap/nextcloud/31033/htdocs/apps/dav/lib/CalDAV/BirthdayService.php#306","Code":0,"Trace":[{"file":"/snap/nextcloud/31033/htdocs/apps/dav/lib/CalDAV/BirthdayService.php","line":306,"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/snap/nextcloud/31033/htdocs/apps/dav/lib/BackgroundJob/GenerateBirthdayCalendarBackgroundJob.php","line":70,"function":"resetForUser","class":"OCA\\DAV\\CalDAV\\BirthdayService","type":"->"},{"file":"/snap/nextcloud/31033/htdocs/lib/public/BackgroundJob/Job.php","line":79,"function":"run","class":"OCA\\DAV\\BackgroundJob\\GenerateBirthdayCalendarBackgroundJob","type":"->"},{"file":"/snap/nextcloud/31033/htdocs/lib/public/BackgroundJob/QueuedJob.php","line":47,"function":"execute","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/snap/nextcloud/31033/htdocs/cron.php","line":151,"function":"execute","class":"OCP\\BackgroundJob\\QueuedJob","type":"->"}],"File":"/snap/nextcloud/31033/htdocs/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"}}
{"reqId":"MpyWrmcaJWkXVa21JqCM","level":2,"time":"2022-07-13T17:55:11+00:00","remoteAddr":"192.168.1.43","user":"--","app":"no app in context","method":"POST","url":"/index.php/login","message":"Login failed: root (Remote IP: 192.168.1.43)","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36","version":"24.0.1.1"}

```

The output of your Apache/nginx/system log in `/var/snap/nextcloud/current/nextcloud/config/config.php`:

```auto

<?php
$CONFIG = array (
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/snap/nextcloud/current/htdocs/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 => 
    array (
      'path' => '/var/snap/nextcloud/current/nextcloud/extra-apps',
      'url' => '/extra-apps',
      'writable' => true,
    ),
  ),
  'supportedDatabases' => 
  array (
    0 => 'mysql',
  ),
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '/tmp/sockets/redis.sock',
    'port' => 0,
  ),
  'log_type' => 'file',
  'logfile' => '/var/snap/nextcloud/current/logs/nextcloud.log',
  'logfilemode' => 416,
  'passwordsalt' => 'CENSURED',
  'secret' => 'CENSURED',
  'trusted_domains' => 
  array (
    0 => 'localhost',
    1 => '192.168.1.63',
  ),
  'datadirectory' => '/var/snap/nextcloud/common/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '24.0.1.1',
  'overwrite.cli.url' => 'http://localhost',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:/tmp/sockets/mysql.sock',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'CENSURED',
  'dbpassword' => 'CENSURED',
  'installed' => true,
  'instanceid' => 'CENSURED',
  'trusted_domain' => 
  array (
    1 => '192.168.1.63',
  ),
  'maintenance' => false,
);

```

Thanks a lot for your help!

---

<div class="post-metadata">

**Author:** ![Mornsgrans](https://help.nextcloud.com/user_avatar/help.nextcloud.com/mornsgrans/32/40386_2.png) [@Mornsgrans](https://help.nextcloud.com/u/Mornsgrans)\
**Post date:** [July 14, 2022, 9:16pm UTC](https://help.nextcloud.com/t/not-able-to-run-nextcloud-enable-https-lets-encrypt/142168/2 "2022-07-14T21:16:03Z")

</div>

> [@jeremy\_fritzen](#):
>
> ```auto
> 'trusted_domains' => 
> array (
> 0 => 'localhost',
> 1 => '192.168.1.63',
> ),
> 
> ```

Letsencrypt only works with a public URI of your Nextcloud (f.e. “[myhost.mydomain.net](http://myhost.mydomain.net)”. The public URI needs to be added to trusted\_domains  
In addition port 80 and 443 need to be forwarded from internet to your Nextcloud.

---

<div class="post-metadata">

**Author:** ![jeremy\_fritzen](https://help.nextcloud.com/user_avatar/help.nextcloud.com/jeremy_fritzen/32/18101_2.png) [@jeremy\_fritzen](https://help.nextcloud.com/u/jeremy_fritzen)\
**Post date:** [July 15, 2022, 9:13pm UTC](https://help.nextcloud.com/t/not-able-to-run-nextcloud-enable-https-lets-encrypt/142168/3 "2022-07-15T21:13:14Z")

</div>

Thanks for your answer.

> [@Mornsgrans](#):
>
> Letsencrypt only works with a public URI of your Nextcloud (f.e. “[myhost.mydomain.net](http://myhost.mydomain.net)”. The public URI needs to be added to trusted\_domains

Yes I know. I just forgot to add the FQDN to the list but that’s not what caused the problem. The missing trusted domain in this array would have caused an error at the time of trying to reach the nextcloud server, but not at the time of executing the lets-encrypt script.

Anyway, I found the issue.  
I was accessing the terminal through an integrated console in Proxmox. It seems that this feature has some bugs because when I access the nextcloud server through another terminal via SSH, it works well.

Thanks!

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 13, 2024, 2:28pm UTC](https://help.nextcloud.com/t/not-able-to-run-nextcloud-enable-https-lets-encrypt/142168/4 "2024-12-13T14:28:31Z")

</div>


