The Free Encyclopedia

Nextcloud External Domain Access Troubleshooting Guide

Revision as of Jun 25, 2026 23:38 by migration. This is an old revision โ€” view current.

Fix external domain access issues when Nextcloud only works locally

๐Ÿ“‚ Infrastructure

โฑ๏ธ 15 minutes

๐Ÿ“Š Intermediate

๐Ÿ‘ค Network Team

๐Ÿ” Problem Description

โŒ Issue Symptoms

Nextcloud instance is accessible locally via http://192.168.1.22/index.php/apps/dashboard/ but fails to load when accessing through the external domain https://cloud.adi-protocol.com/index.php/login.

This is a common configuration issue where Nextcloud's trusted domains and URL overwrite settings are not properly configured for external access. The application works perfectly on the local network but becomes inaccessible from outside due to mismatched domain configurations.

๐ŸŽฏ Root Cause Analysis

After examining the initial Nextcloud configuration, the issue was identified in the config/config.php file:

PHP - Original Configuration

'trusted_domains' => 
array (
  0 => '192.168.1.22',
  1 => 'cloud.adi-protocol.com',  // โœ… Correctly configured
),
'overwrite.cli.url' => 'http://192.168.1.22',  // โŒ Problem: Local IP only

๐Ÿ’ก Key Finding

The trusted_domains was correctly configured, but the overwrite.cli.url setting was pointing to the local IP address with HTTP protocol instead of the external domain with HTTPS.

๐Ÿ› ๏ธ Solution Implementation

โœ… Configuration Fix

The solution involves updating three critical configuration parameters in Nextcloud's config file.

  1. Access the Nextcloud configuration file

    Bash

    sudo nano /var/www/cloud/config/config.php
  2. Update the overwrite.cli.url setting

    Change from local IP to external domain with HTTPS:

    PHP - Before

    'overwrite.cli.url' => 'http://192.168.1.22',

    PHP - After

    'overwrite.cli.url' => 'https://cloud.adi-protocol.com',
  3. Add missing overwrite parameters

    Add these two new configuration lines after the overwrite.cli.url setting:

    PHP

    'overwritehost' => 'cloud.adi-protocol.com',
    'overwriteprotocol' => 'https',
  4. Verify the complete configuration

    The final configuration should look like this:

    PHP - Final Configuration

     'ocslxlchipvt',
      'passwordsalt' => 'xUAo0F+fCfBuRx3n38TWWwUP6ImRrP',
      'secret' => 'IW9UbeK2ybtmC1KB9x5CTql5Ad+ZnpkeAMRcP4V5UDpp+wPJ',
      'trusted_domains' => 
      array (
        0 => '192.168.1.22',
        1 => 'cloud.adi-protocol.com',
      ),
      'datadirectory' => '/mnt/storage',
      'dbtype' => 'mysql',
      'version' => '31.0.8.1',
      'overwrite.cli.url' => 'https://cloud.adi-protocol.com',
      'overwritehost' => 'cloud.adi-protocol.com',
      'overwriteprotocol' => 'https',
      'dbname' => 'nextcloud_db',
      'dbhost' => '192.168.1.60',
      'dbport' => '',
      'dbtableprefix' => 'oc_',
      'mysql.utf8mb4' => true,
      'dbuser' => 'nextcloud_user',
      'dbpassword' => 'DB_EINstein1775_nextcloud_user',
      'installed' => true,
      'defaultapp' => 'dashboard',
    );
  5. Save and restart the web server

    Save the configuration file and restart your web server:

    Bash - Apache

    sudo systemctl restart apache2

    Bash - Nginx

    sudo systemctl restart nginx
  6. Test external access

    Navigate to https://cloud.adi-protocol.com/index.php/login to verify the fix.

๐Ÿ“– Configuration Parameters Explained

๐Ÿ”ง Parameter Functions

overwrite.cli.url: Sets the base URL used by Nextcloud for generating links and redirects. This must match your external domain.

overwritehost: Forces Nextcloud to use a specific hostname in generated URLs instead of detecting it from the request headers.

overwriteprotocol: Ensures Nextcloud generates HTTPS URLs even when accessed through proxies or load balancers that might strip SSL.

โš ๏ธ Important Notes

These settings are crucial when using reverse proxies, load balancers, or accessing Nextcloud through external domains. Without proper configuration, Nextcloud may generate incorrect URLs that point to local addresses instead of external domains.

๐Ÿ“‹ Prerequisites for External Access

Before implementing this fix, ensure these infrastructure requirements are met:

  1. Valid SSL Certificate

    Your domain must have a valid SSL certificate configured for HTTPS access. Use Let's Encrypt or a commercial certificate.

  2. DNS Configuration

    Verify that cloud.adi-protocol.com resolves to your public IP address.

  3. Port Forwarding

    Configure your router to forward port 443 (HTTPS) to your Nextcloud server at 192.168.1.22.

  4. Firewall Configuration

    Ensure your server's firewall allows incoming HTTPS connections on port 443.

๐Ÿ”ง Additional Troubleshooting

If the configuration fix doesn't resolve the issue, check these additional factors:

๐Ÿšจ Common Issues

SSL Certificate Problems: Verify your SSL certificate is valid and properly configured for your domain.

Network Connectivity: Test if your domain resolves correctly from external networks.

Web Server Configuration: Check Apache/Nginx virtual host configurations for domain-specific settings.

Cache Issues: Clear browser cache and try accessing from a different browser or incognito mode.

๐ŸŽ‰ Resolution Results

โœ… Success

After implementing the configuration changes and restarting the web server, external access to Nextcloud was successfully restored. Users can now access the instance from anywhere using https://cloud.adi-protocol.com while maintaining local network access via the IP address.

๐Ÿ”„ Dual Access

The solution maintains backward compatibility, allowing both local IP access (http://192.168.1.22) and external domain access (https://subdomain.domain.com) to function simultaneously.

Nextcloud External Access Domain Configuration SSL/TLS Web Server Infrastructure Troubleshooting System Administration