Reverse Proxy On Existing Install

Nextcloud version (eg, 20.0.5): 7.11.2
Operating system and version (eg, Ubuntu 20.04): AIO
Apache or nginx version (eg, Apache 2.4.25): AIO
PHP version (eg, 7.4): AIO

The issue you are facing:

Getting error 504 more time than not, when I attempt to connect to my Nextcloud AIO behind reverse proxy. It appears my existing install can not be tweaked to works behind reverse proxy. I tested doing a restore and brand new install, and it does appears to work properly. Wondering if there is any tweak that can be done to get existing install to work. If this is not possible what volumes and containers should be deleted prior to restore? Also the apache container is showing unhealthy status

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

Steps to replicate it:

  1. Setup AIO W/O Reverse Proxy using docker compose
  2. Stop all Nextcloud containers running in docker
  3. Setup HA Proxy per all-in-one/reverse-proxy.md at main · nextcloud/all-in-one · GitHub
  4. Update docker compose to work with revers proxy - copy existing compose file, in new copy comment out port 80 and 8443, add APACHE_PORT=11000, and APACHE_IP_BINDING=0.0.0.0 to environment
  5. Start AIO with new compose file

The output of your Nextcloud log in Admin > Logging:

Unable to grab due to issue

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

<?php
$CONFIG = array (
  'one-click-instance' => true,
  'one-click-instance.user-limit' => 100,
  '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,
    ),
  ),
  'check_data_directory_permissions' => false,
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'nextcloud-aio-redis',
    'password' => 'REDACTED',
    'port' => 6379,
  ),
  'overwritehost' => 'redacted.com',
  'overwriteprotocol' => 'https',
  'passwordsalt' => 'REDACTED',
  'secret' => 'REDACTED',
  'trusted_domains' => 
  array (
    0 => 'localhost',
    1 => 'REDACTED.com',
  ),
  'datadirectory' => '/mnt/ncdata',
  'dbtype' => 'pgsql',
  'version' => '27.1.5.1',
  'overwrite.cli.url' => 'https://redacted.com/',
  'dbname' => 'nextcloud_database',
  'dbhost' => 'nextcloud-aio-database',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'oc_nextcloud',
  'dbpassword' => 'REDACTED',
  'installed' => true,
  'instanceid' => 'ocb4nuhonq0w',
  'maintenance' => false,
  'loglevel' => '2',
  'log_type' => 'file',
  'logfile' => '/var/www/html/data/nextcloud.log',
  'log_rotate_size' => '10485760',
  'log.condition' => 
  array (
    'apps' => 
    array (
      0 => 'admin_audit',
    ),
  ),
  'preview_max_x' => '2048',
  'preview_max_y' => '2048',
  'jpeg_quality' => '60',
  'enabledPreviewProviders' => 
  array (
    1 => 'OC\\Preview\\Image',
    2 => 'OC\\Preview\\MarkDown',
    3 => 'OC\\Preview\\MP3',
    4 => 'OC\\Preview\\TXT',
    5 => 'OC\\Preview\\OpenDocument',
    6 => 'OC\\Preview\\Movie',
    7 => 'OC\\Preview\\Krita',
    0 => 'OC\\Preview\\Imaginary',
  ),
  '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',
  'htaccess.RewriteBase' => '/',
  'files_external_allow_create_new_local' => false,
  'trusted_proxies' => 
  array (
    0 => '127.0.0.1',
    1 => '::1',
  ),
  'allow_local_remote_servers' => true,
  'preview_imaginary_url' => 'http://nextcloud-aio-imaginary:9000',
  'mail_sendmailmode' => 'smtp',
  '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',
  'twofactor_enforced' => 'false',
  'twofactor_enforced_groups' => 
  array (
  ),
  'twofactor_enforced_excluded_groups' => 
  array (
  ),
  'davstorage.request_timeout' => 3600,
  'dbpersistent' => false,
  'mail_smtpname' => 'REDACTED',
  'mail_smtppassword' => 'REDACTED',
  'mail_domain' => 'gmail.com',
  'mail_from_address' => 'REDACTED',
  'mail_smtphost' => 'smtp.gmail.com',
  'mail_smtpauth' => 1,
  'mail_smtpport' => '587',
  'appsallowlist' => 
  array (
  ),
);

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

#Filtered down to show relevant message from IP I am connecting from
172.21.10.109, 172.21.8.1 - - [20/Feb/2024:12:17:15 -0500] "GET / HTTP/1.1" 302 - "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:122.0) Gecko/20100101 Firefox/122.0"
172.21.10.109, 172.21.8.1 - - [20/Feb/2024:12:17:15 -0500] "GET /login HTTP/1.1" 200 7277 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:122.0) Gecko/20100101 Firefox/122.0"
172.21.10.109, 172.21.8.1 - - [20/Feb/2024:12:17:54 -0500] "GET /login HTTP/1.1" 200 7281 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:122.0) Gecko/20100101 Firefox/122.0"
172.21.10.109, 172.21.8.1 - - [20/Feb/2024:12:20:15 -0500] "GET /login HTTP/1.1" 200 7280 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:122.0) Gecko/20100101 Firefox/122.0"
172.21.10.109, 172.21.8.1 - - [20/Feb/2024:16:11:11 -0500] "GET /login HTTP/1.1" 200 7284 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:122.0) Gecko/20100101 Firefox/122.0"

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.

could not find file in aio-apache container

Hi, can you follow all-in-one/reverse-proxy.md at main · nextcloud/all-in-one · GitHub?

Thanks for the reply. I did follow this guide to setup my HA Proxy. It seem to work with new installs, but fails for my existing install by updating my docker compose change listening ports.