Cannot access my Nextcloud instance externally

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): 25.0.0 RC3
Operating system and version (eg, Ubuntu 20.04): Linux version 5.15.76-v8+ (dom@buildbot) (aarch64-linux-gnu-gcc-8 (Ubuntu/Linaro 8.4.0-3ubuntu1) 8.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34)
Apache or nginx version (eg, Apache 2.4.25): Server version: Apache/2.4.54 (Debian)
PHP version (eg, 7.4): PHP 7.4.33 (cli)

The issue you are facing:

Sorry for the newbie question. I am not much of a savvy and have limited IT knowledge on coding etc, so please bear with me.

I am not able to connect to my nextcloud instance via its domain (nextcloud.domain.com) outside my wifi network at home. The instance is running on a Raspberry Pi 4 which is connected via wifi not ethernet. I have managed to get certbot and letsencrypt running so it has got https working well.

When I attempt to add calendar events from another network/IP, it adds the event in the device’s calendar but the instance doesn’t update as the device doesn’t connect to it. The landing page of my instance doesn’t open either.

As far as I know ports 80 and 443 have been open in my router.

What can I do to fix this?

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

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'xxxx',
  'passwordsalt' => 'xxxx',
  'secret' => 'xxxx',
  'trusted_domains' =>
  array (
    0 => '192.XXX.XXX.XXX',
    1 => 'nextcloud.domain.com',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '25.0.0.15',
  'overwrite.cli.url' => 'https://nextcloud.domain.com',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'xxxx',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'default_phone_region' => 'GB',
  'mail_from_address' => 'xxx',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'xxx.com',
  'mail_smtpsecure' => 'tls',
  'mail_smtpport' => '587',
  'mail_smtphost' => 'xxx.com',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'xxx@xxx.com',
  'mail_smtppassword' => 'xxxx',
  'maintenance' => false,
  'updater.secret' => 'xxxx',
);


The output of your Apache/nginx/system log in /var/log/____:

Not sure where to get this, is it the info in the apache2.conf file?

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

Not sure where to get this

Are those ports (443, 80) forwarded in the router? Also, I guess your domain is actually resolvable from the internet, cause if not, you would need to set up a VPN server to access it from outside your LAN

Regarding the logs, you need to copy them from CLI. In the nextcloud path (usually /var/www/nextcloud) you will find several directories, one of them called data, there is the nextcloud.log by default (in my case is /var/www/nextcloud/data/nextcloud.log).

The webserver logs will be at /var/log/[the-webserver-name]

In my case, apache ones are located at /var/log/apache2/ an there you will find the access, access_ssl and error logs

The last few lines of the apache2 error logs are as below: - nothing that catches my eyes.

2a00:XXXX:ed82:XXXXXf:b800:53d2:XXX - user[14/Dec/2022:20:38:52 +0000] “PROPFIND /remote.php/dav/calendars/user/ HTTP/1.1” 207 1352
2a00:XXXX:ed82:XXXXXf:b800:53d2:XXX - - [14/Dec/2022:20:38:53 +0000] “PROPFIND /remote.php/dav/calendars/user/inbox/ HTTP/1.1” 401 557
2a00:XXXX:ed82:XXXXXf:b800:53d2:XXX - user [14/Dec/2022:20:38:53 +0000] “PROPFIND /remote.php/dav/calendars/user/inbox/ HTTP/1.1” 207 248
2a00:XXXX:ed82:XXXXXf:b800:53d2:XXX - - [14/Dec/2022:20:38:53 +0000] “PROPFIND /remote.php/dav/calendars/user/inbox/ HTTP/1.1” 401 557
2a00:XXXX:ed82:XXXXXf:b800:53d2:XXX - user [14/Dec/2022:20:38:53 +0000] “PROPFIND /remote.php/dav/calendars/user/inbox/ HTTP/1.1” 207 248

from where are you trying to add those calendar events?

Based on that, it sounds like your port 80 is working but 443 isn’t. Certbot would not verify without port 80. Can you confirm if port 443 (HTTPS) is reachable? Try the tools below.

https://scan.nextcloud.com

https://port.tools/nmap-online-port-scan/

Thank you for trying to help!

The scan from the nextcloud page indicates my system is rated as A and not +A because I am NOT on latest patch level.

I tried the online port scan tools, and it seems that both port 80 and 443 are closed. But how is this possible if certbot was installed? My internet router is very basic and I have set up some portforwarding but I am not sure how well this was done.