Security & setup warning "Error: Cannot connect to server"

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 31.0.8
  • Operating system and version (e.g., Ubuntu 24.04):
    • Ubuntu 24.04.2
  • Web server and version (e.g, Apache 2.4.25):
    • Apache 2.4.65
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • Caddy 2.10.0
  • PHP version (e.g, 8.3):
    • 8.3.24
  • Is this the first time you’ve seen this error? (Yes / No):
    • No
  • When did this problem seem to first start?
    • Several months ago
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • AIO
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • No

Summary of the issue you are facing:

For several months now, nextcloud has been reporting errors about not being able to connect to itself. I’m running the most recent stable version of nextcloud aio on ubuntu 24.04 with community containers caddy, jellyfin, jellyseer, and fail2ban. I’ve tried the basic troubleshooting it recommends with no luck. I found a few threads with users who had similar issues, but their fixes did not work either. I also tried disabling all community containers, but then was unable to connect to the server at all. I’ve been having an issue with Nextcloud talk where I cannot make group chats which I believe may be related. Additionally, the server is able to ping itself if I manually run a ping command from the nextcloud-aio-nextcloud container. Any suggestions would be very much appreciated. Happy to provide any additional information.

There are some errors regarding your setup.

Error: Cannot connect to server

Could not check that the data directory is protected. Please check manually that your server does not allow access to the data directory. To allow this check to run you have to make sure that your Web server can connect to itself. Therefore it must be able to resolve and connect to at least one of its `trusted_domains` or the `overwrite.cli.url`. This failure may be the result of a server-side DNS mismatch or outbound firewall rule.
Your webserver is not set up to serve `.js.map` files. Without these files, JavaScript Source Maps won't function properly, making it more challenging to troubleshoot and debug any issues that may arise.
Unable to run check for JavaScript support. Please remedy or confirm manually if your webserver serves `.mjs` files using the JavaScript MIME type. To allow this check to run you have to make sure that your Web server can connect to itself. Therefore it must be able to resolve and connect to at least one of its `trusted_domains` or the `overwrite.cli.url`. This failure may be the result of a server-side DNS mismatch or outbound firewall rule.
Could not check if your web server properly resolves the OCM and OCS provider URLs. To allow this check to run you have to make sure that your Web server can connect to itself. Therefore it must be able to resolve and connect to at least one of its `trusted_domains` or the `overwrite.cli.url`. This failure may be the result of a server-side DNS mismatch or outbound firewall rule.
91 errors in the logs since July 26, 2025, 12:15:25 AM

Could not check that your web server is properly set up to allow file synchronization over WebDAV. Please check manually. To allow this check to run you have to make sure that your Web server can connect to itself. Therefore it must be able to resolve and connect to at least one of its `trusted_domains` or the `overwrite.cli.url`. This failure may be the result of a server-side DNS mismatch or outbound firewall rule. For more details see the [documentation ↗](https://docs.nextcloud.com/server/31/go.php?to=admin-setup-well-known-URL).
Could not check that your web server serves `.well-known` correctly. Please check manually. To allow this check to run you have to make sure that your Web server can connect to itself. Therefore it must be able to resolve and connect to at least one of its `trusted_domains` or the `overwrite.cli.url`. This failure may be the result of a server-side DNS mismatch or outbound firewall rule. For more details see the [documentation ↗](https://docs.nextcloud.com/server/31/go.php?to=admin-setup-well-known-URL).
Could not check for otf loading support. Please check manually if your webserver serves `.otf` files. To allow this check to run you have to make sure that your Web server can connect to itself. Therefore it must be able to resolve and connect to at least one of its `trusted_domains` or the `overwrite.cli.url`. This failure may be the result of a server-side DNS mismatch or outbound firewall rule. For more details see the [documentation ↗](https://docs.nextcloud.com/server/31/go.php?to=admin-nginx).
Could not check that your web server serves security headers correctly. Please check manually. For more details see the [documentation ↗](https://docs.nextcloud.com/server/31/go.php?to=admin-security).
You have not set or verified your email server configuration, yet. Please head over to the "Basic settings" in order to set them. Afterwards, use the "Send email" button below the form to verify your settings. For more details see the [documentation ↗](https://docs.nextcloud.com/server/31/go.php?to=admin-email).
No recording backend configured
No SIP backend configured
Could not check for WASM loading support. Please check manually if your web server serves `.wasm` files. To allow this check to run you have to make sure that your Web server can connect to itself. Therefore it must be able to resolve and connect to at least one of its `trusted_domains` or the `overwrite.cli.url`. This failure may be the result of a server-side DNS mismatch or outbound firewall rule. For more details see the [documentation ↗](https://docs.nextcloud.com/server/31/go.php?to=admin-nginx).

Steps to replicate it (hint: details matter!):

Unsure, just appeared a few months back

Log entries

Nextcloud

Please provide the log entries from your Nextcloud log that are generated during the time of problem (via the Copy raw option from Administration settings->Logging screen or from your nextcloud.log located in your data directory). Feel free to use a pastebin/gist service if necessary.

Web server / Reverse Proxy

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

2025-08-23T08:18:02.331686353Z Waiting for Nextcloud to start...
2025-08-23T08:18:07.340460344Z Waiting for Nextcloud to start...
2025-08-23T08:18:12.344288695Z Waiting for Nextcloud to start...
2025-08-23T08:18:17.348458171Z Waiting for Nextcloud to start...
2025-08-23T08:18:22.351480831Z Waiting for Nextcloud to start...
2025-08-23T08:18:27.354460100Z Waiting for Nextcloud to start...
2025-08-23T08:18:32.356983416Z Waiting for Nextcloud to start...
2025-08-23T08:18:37.359851574Z Waiting for Nextcloud to start...
2025-08-23T08:18:42.362358742Z Waiting for Nextcloud to start...
2025-08-23T08:18:47.364633818Z Waiting for Nextcloud to start...
2025-08-23T08:18:52.367357975Z Waiting for Nextcloud to start...
2025-08-23T08:18:57.369712791Z Waiting for Nextcloud to start...
2025-08-23T08:19:02.372989218Z Waiting for Nextcloud to start...
2025-08-23T08:19:07.375657937Z Waiting for Nextcloud to start...
2025-08-23T08:19:12.379638192Z Waiting for Nextcloud to start...
2025-08-23T08:19:17.382601977Z Waiting for Nextcloud to start...
2025-08-23T08:19:22.384873259Z Waiting for Nextcloud to start...
2025-08-23T08:19:27.387196406Z Waiting for Nextcloud to start...
2025-08-23T08:19:32.389470411Z Waiting for Nextcloud to start...
2025-08-23T08:19:37.391793212Z Waiting for Nextcloud to start...
2025-08-23T08:19:42.394467768Z Waiting for Nextcloud to start...
2025-08-23T08:19:47.397539500Z Waiting for Nextcloud to start...
2025-08-23T08:19:52.400187277Z Waiting for Nextcloud to start...
2025-08-23T08:19:57.403270686Z Waiting for Nextcloud to start...
2025-08-23T08:20:02.405527667Z Waiting for Nextcloud to start...
2025-08-23T08:20:07.408423291Z Waiting for Nextcloud to start...
2025-08-23T08:20:12.412030600Z Waiting for Nextcloud to start...
2025-08-23T08:20:17.415075361Z Waiting for Nextcloud to start...
2025-08-23T08:20:22.418021172Z Waiting for Nextcloud to start...
2025-08-23T08:20:27.421158055Z Waiting for Nextcloud to start...
2025-08-23T08:20:32.424587143Z Waiting for Nextcloud to start...
2025-08-23T08:20:37.427459391Z Waiting for Nextcloud to start...
2025-08-23T08:20:42.429780061Z Waiting for Nextcloud to start...
2025-08-23T08:20:47.432048684Z Waiting for Nextcloud to start...
2025-08-23T08:20:52.434367213Z Waiting for Nextcloud to start...
2025-08-23T08:20:57.437710380Z Waiting for Nextcloud to start...
2025-08-23T08:21:02.441323208Z Waiting for Nextcloud to start...
2025-08-23T08:21:07.444282690Z Waiting for Nextcloud to start...
2025-08-23T08:21:12.447342216Z Waiting for Nextcloud to start...
2025-08-23T08:21:17.451648053Z Waiting for Nextcloud to start...
2025-08-23T08:21:22.454038665Z Waiting for Nextcloud to start...
2025-08-23T08:21:27.457630648Z Waiting for Nextcloud to start...
2025-08-23T08:21:32.460292188Z Waiting for Nextcloud to start...
2025-08-23T08:21:37.462464896Z Waiting for Nextcloud to start...
2025-08-23T08:21:42.464576565Z Waiting for Nextcloud to start...
2025-08-23T08:21:47.466855090Z Waiting for Nextcloud to start...
2025-08-23T08:21:52.469038757Z Waiting for Nextcloud to start...
2025-08-23T08:21:57.471322630Z Waiting for Nextcloud to start...
2025-08-23T08:22:02.473437961Z Waiting for Nextcloud to start...
2025-08-23T08:22:07.475652780Z Waiting for Nextcloud to start...
2025-08-23T08:22:12.482746886Z Connection to nextcloud-aio-nextcloud (172.18.0.11) 9000 port [tcp/*] succeeded!
2025-08-23T08:22:13.066719126Z /usr/lib/python3.12/site-packages/supervisor/options.py:13: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
2025-08-23T08:22:13.066757173Z   import pkg_resources
2025-08-23T08:22:14.190718148Z [Sat Aug 23 04:22:14.190205 2025] [mpm_event:notice] [pid 190:tid 190] AH00489: Apache/2.4.65 (Unix) configured -- resuming normal operations
2025-08-23T08:22:14.190753254Z [Sat Aug 23 04:22:14.190295 2025] [core:notice] [pid 190:tid 190] AH00094: Command line: '/usr/local/apache2/bin/httpd -D FOREGROUND'
2025-08-23T08:22:14.206738913Z {"level":"info","ts":1755937334.2063606,"msg":"maxprocs: Leaving GOMAXPROCS=8: CPU quota undefined"}
2025-08-23T08:22:14.207000386Z {"level":"info","ts":1755937334.2067802,"msg":"GOMEMLIMIT is updated","package":"github.com/KimMachineGun/automemlimit/memlimit","GOMEMLIMIT":15003799142,"previous":9223372036854775807}
2025-08-23T08:22:14.207024603Z {"level":"info","ts":1755937334.2068458,"msg":"using config from file","file":"/tmp/Caddyfile"}
2025-08-23T08:22:14.210275266Z {"level":"info","ts":1755937334.2100213,"msg":"adapted config to JSON","adapter":"caddyfile"}
2025-08-23T08:22:14.218506198Z {"level":"info","ts":1755937334.2182808,"msg":"serving initial configuration"}

Configuration

Nextcloud

The output of occ config:list system or similar is best, but, if not possible, the contents of your config.php file from /path/to/nextcloud is fine (make sure to remove any identifiable information!):

{
    "system": {
        "one-click-instance": true,
        "one-click-instance.user-limit": 100,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "appsallowlist": false,
        "check_data_directory_permissions": false,
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "password": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "overwritehost": "***REDACTED DOMAIN***",
        "overwriteprotocol": "https",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost",
            "***REDACTED DOMAIN***",
            "192.168.8.151",
            "127.0.0.1",
            "moose"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "31.0.8.1",
        "overwrite.cli.url": "https:\/\/***REDACTED DOMAIN***\/",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "maintenance": false,
        "loglevel": 2,
        "log_type": "file",
        "logfile": "\/var\/www\/html\/data\/nextcloud.log",
        "log_rotate_size": "10485760",
        "log.condition": {
            "apps": [
                "admin_audit"
            ]
        },
        "preview_max_x": 2048,
        "preview_max_y": 2048,
        "jpeg_quality": 60,
        "enabledPreviewProviders": {
            "0": "OC\\Preview\\Imaginary",
            "1": "OC\\Preview\\MP3",
            "2": "OC\\Preview\\TXT",
            "3": "OC\\Preview\\OpenDocument",
            "4": "OC\\Preview\\Movie",
            "5": "OC\\Preview\\Krita",
            "6": "OC\\Preview\\ImaginaryPDF",
            "7": "OC\\Preview\\ImaginaryPDF",
            "23": "OC\\Preview\\ImaginaryPDF"
        },
        "enable_previews": true,
        "upgrade.disable-web": true,
        "mail_smtpmode": "smtp",
        "trashbin_retention_obligation": "auto, 30",
        "versions_retention_obligation": "auto, 30",
        "activity_expire_days": "30",
        "simpleSignUpLink.shown": false,
        "share_folder": "\/Shared",
        "one-click-instance.link": "https:\/\/nextcloud.com\/all-in-one\/",
        "upgrade.cli-upgrade-link": "https:\/\/github.com\/nextcloud\/all-in-one\/discussions\/2726",
        "updatedirectory": "\/nc-updater",
        "allow_local_remote_servers": true,
        "davstorage.request_timeout": 3600,
        "htaccess.RewriteBase": "\/",
        "dbpersistent": false,
        "files_external_allow_create_new_local": true,
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "preview_imaginary_url": "***REMOVED SENSITIVE VALUE***",
        "memories.exiftool": "\/var\/www\/html\/custom_apps\/memories\/bin-ext\/exiftool-amd64-musl",
        "memories.vod.path": "\/var\/www\/html\/custom_apps\/memories\/bin-ext\/go-vod-amd64",
        "memories.vod.ffmpeg": "\/usr\/bin\/ffmpeg",
        "memories.vod.ffprobe": "\/usr\/bin\/ffprobe",
        "memories.vod.connect": "nextcloud-aio-memories:47788",
        "maintenance_window_start": 100,
        "preview_imaginary_key": "***REMOVED SENSITIVE VALUE***",
        "memories.gis_type": 2,
        "default_phone_region": "US",
        "mail_sendmailmode": "smtp",
        "memories.db.triggers.fcu": true,
        "auth.bruteforce.protection.enabled": true,
        "ratelimit.protection.enabled": true,
        "documentation_url.server_logs": "https:\/\/github.com\/nextcloud\/all-in-one\/discussions\/5425",
        "updatechecker": false,
        "DOMAIN": "***REDACTED DOMAIN***"
    }
}

Apps

The output of occ app:list (if possible).

Enabled:
  - activity: 4.0.0
  - admin_audit: 1.21.0
  - bruteforcesettings: 4.0.0
  - calendar: 5.3.9
  - circles: 31.0.0
  - cloud_federation_api: 1.14.0
  - comments: 1.21.0
  - contacts: 7.2.5
  - contactsinteraction: 1.12.0
  - cookbook: 0.11.3
  - cospend: 3.0.11
  - dashboard: 7.11.0
  - dav: 1.33.0
  - deck: 1.15.2
  - federatedfilesharing: 1.21.0
  - federation: 1.21.0
  - files: 2.3.1
  - files_downloadlimit: 4.0.0
  - files_external: 1.23.0
  - files_fulltextsearch: 31.0.0
  - files_pdfviewer: 4.0.0
  - files_reminders: 1.4.0
  - files_retention: 2.0.1
  - files_sharing: 1.23.1
  - files_trashbin: 1.21.0
  - files_versions: 1.24.0
  - firstrunwizard: 4.0.0
  - fulltextsearch: 31.0.0
  - fulltextsearch_elasticsearch: 31.0.0
  - groupfolders: 19.1.3
  - logreader: 4.0.0
  - lookup_server_connector: 1.19.0
  - memories: 7.6.2
  - nextcloud-aio: 0.8.0
  - nextcloud_announcements: 3.0.0
  - notes: 4.12.3
  - notifications: 4.0.0
  - notify_push: 1.2.0
  - oauth2: 1.19.1
  - password_policy: 3.0.0
  - phonetrack: 0.8.2
  - photos: 4.0.0
  - previewgenerator: 5.9.0
  - privacy: 3.0.0
  - profile: 1.0.0
  - provisioning_api: 1.21.0
  - recognize: 9.0.3
  - recommendations: 4.0.0
  - related_resources: 2.0.0
  - richdocuments: 8.7.4
  - serverinfo: 3.0.0
  - settings: 1.14.0
  - sharebymail: 1.21.0
  - support: 3.0.0
  - survey_client: 3.0.0
  - suspicious_login: 9.0.1
  - systemtags: 1.21.1
  - tasks: 0.16.1
  - text: 5.0.0
  - theming: 2.6.1
  - twofactor_backupcodes: 1.20.0
  - twofactor_nextcloud_notification: 5.0.0
  - twofactor_totp: 13.0.0-dev.0
  - twofactor_webauthn: 2.3.0
  - updatenotification: 1.21.0
  - user_status: 1.11.0
  - viewer: 4.0.0
  - weather_status: 1.11.0
  - webhook_listeners: 1.2.0
  - workflowengine: 2.13.0
Disabled:
  - app_api: 5.0.2 (installed 4.0.5)
  - encryption: 2.19.0
  - mail: 5.3.1 (installed 5.3.1)
  - maps: 1.6.0 (installed 1.6.0)
  - user_ldap: 1.22.0

The connection goes thru your reverse proxy and the web front-end. “Itself” is really the entire stack, not the container itself.

Try testing with curl or similar to the URL listed in the overwrite.cli.url.

1 Like

Interesting. It definitely looks like curl does not work.

* Host domain.com:80 was resolved.
* IPv6: (none)
* IPv4: [ipaddress]
*   Trying [ipaddress]:80...
* connect to [ipaddress] port 80 from 172.18.0.11 port 60984 failed: Operation timed out
* Failed to connect to domain.com port 80 after 134894 ms: Could not connect to server
* closing connection #0
curl: (28) Failed to connect to domain.com port 80 after 134894 ms: Could not connect to server

Your curl attempt looks like it’s http. Aren’t you using https?

1 Like

I am using https. Not sure why curl attempted http only. I’ll try again specifying https.

Update:

* Host domain.com:443 was resolved.
* IPv6: (none)
* IPv4: [ipaddress]
*   Trying [ipaddress]:443...
* connect to [ipaddress] port 443 from 172.18.0.11 port 40016 failed: Operation timed out
* Failed to connect to domain.com port 443 after 133230 ms: Could not connect to server
* closing connection #0
curl: (28) Failed to connect to domain.com port 443 after 133230 ms: Could not connect to server

Update: Not sure what, but something must have been misconfigured at the router level because I got a new router today and these error messages went away.

1 Like

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.