NC AIO Bad Gateway

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): Nextcloud AIO v5.2.2
Operating system and version (eg, Ubuntu 20.04): Docker Arch
Apache or nginx version (eg, Apache 2.4.25): 2.4.57
PHP version (eg, 7.4): replace me

The issue you are facing:

After starting nextcloud AIO and all is up and running i just get a 502 bad gateway, was working bevore without problems.

tried to open the apache port but also a bad gateway, i dont find any errors

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

Steps to replicate it:

  1. Start master container
  2. start containers through web page
  3. try to open nextcloud page

The output of your Nextcloud log in Admin > Logging:

dont even get written to

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

<?php
$CONFIG = array (
  '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,
    ),
  ),
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'nextcloud-aio-redis',
    'password' => '1c85ab2cc730c4f08763b91e4aa320b68e1490e9a793a811',
    'port' => 6379,
  ),
  'overwritehost' => 'sub.domain.tld',
  'overwriteprotocol' => 'https',
  'passwordsalt' => 'xxx',
  'secret' => 'xxx',
  'trusted_domains' => 
  array (
    0 => 'localhost',
    1 => 'sub.domain.tld',
  ),
  'datadirectory' => '/mnt/ncdata',
  'dbtype' => 'pgsql',
  'version' => '26.0.1.0',
  'overwrite.cli.url' => 'https://sub.domain.tld/',
  'dbname' => 'nextcloud_database',
  'dbhost' => 'nextcloud-aio-database',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'oc_nextcloud',
  'dbpassword' => 'xxx',
  'installed' => true,
  'instanceid' => 'xxx',
  'check_data_directory_permissions' => true,
  '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',
    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',
  'tempdirectory' => '/mnt/ncdata/tmp/',
  'one-click-instance' => true,
  'one-click-instance.user-limit' => 100,
  'one-click-instance.link' => 'https://nextcloud.com/all-in-one/',
  'htaccess.RewriteBase' => '/',
  'files_external_allow_create_new_local' => false,
  'trusted_proxies' => 
  array (
    0 => '127.0.0.1',
    1 => '::1',
  ),
  'allow_local_remote_servers' => true,
  'default_phone_region' => 'DE',
  'mail_smtpauthtype' => 'PLAIN',
  'mail_sendmailmode' => 'smtp',
  'mail_smtphost' => 'sub.domain.tld',
  'mail_from_address' => 'cloud',
  'mail_domain' => 'domain.tld',
  'mail_smtpsecure' => 'tls',
  'mail_smtpport' => '25',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'sub.domain.tld',
  'mail_smtppassword' => 'xxx',
  'enforce_theme' => '',
  'preview_imaginary_url' => 'http://nextcloud-aio-imaginary:9000',
  'ncd_admin_settings' => 
  array (
    'disallow_aria2_settings' => '1',
  ),
  'global_aria2_config' => 
  array (
  ),
  'updatedirectory' => '/nc-updater',
  'updater.release.channel' => 'stable',
  'app_install_overwrite' => 
  array (
    0 => 'nextcloud-aio',
    1 => 'ncdownloader',
  ),
);

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

....
Waiting for Nextcloud to start...
Waiting for Nextcloud to start...
Waiting for Nextcloud to start...
Waiting for Nextcloud to start...
{"level":"info","ts":1685968721.8234026,"msg":"using provided configuration","config_file":"/Caddyfile","config_adapter":""}
[Mon Jun 05 14:38:41.826580 2023] [mpm_event:notice] [pid 232:tid 139652229217096] AH00489: Apache/2.4.57 (Unix) configured -- resuming normal operations
[Mon Jun 05 14:38:41.826614 2023] [core:notice] [pid 232:tid 139652229217096] AH00094: Command line: '/usr/local/apache2/bin/httpd -D FOREGROUND'

Nextcloud container log

now              
-------------------------------
 2023-06-05 14:33:32.964148+02
(1 row)

+ '[' -f /dev-dri-group-was-added ']'
++ find /dev -maxdepth 1 -mindepth 1 -name dri
+ '[' -n '' ']'
+ set +x
Installing imagemagick via apk...
Installing tesseract-ocr via apk...
Installing tesseract-ocr-deu via apk...
ERROR: unable to select packages:
The packet tesseract-ocr-deu was not installed!
Installing tesseract-ocr-eng via apk...
ERROR: unable to select packages:
The packet tesseract-ocr-eng was not installed!
Installing aria2 via apk...
Installing yt-dlp via apk...
Installing ocrmypdf via apk...
Installing sane-utils via apk...
Enabling Imagick...
Configuring Redis as session handler...
Setting php max children...
System config value tempdirectory set to string /mnt/ncdata/tmp/
Applying one-click-instance settings...
System config value one-click-instance set to boolean true
System config value one-click-instance.user-limit set to integer 100
System config value one-click-instance.link set to string https://nextcloud.com/all-in-one/
support already enabled
Adjusting log files...
System config value logfile set to string /var/www/html/data/nextcloud.log
Config value logfile for app admin_audit set to /var/www/html/data/audit.log
System config value updatedirectory set to string /nc-updater
Applying network settings...
System config value trusted_domains => 1 set to string sub.domain.tld
System config value overwrite.cli.url set to string https://sub.domain.tld/
System config value htaccess.RewriteBase set to string /
.htaccess has been updated
System config value files_external_allow_create_new_local set to boolean false
System config value trusted_proxies => 0 set to string 127.0.0.1
System config value trusted_proxies => 1 set to string ::1
Config value base_endpoint for app notify_push set to https://sub.domain.tld/push
System config value enabledPreviewProviders => 0 set to string OC\Preview\Imaginary
System config value preview_imaginary_url set to string http://nextcloud-aio-imaginary:9000
{
    "search_platform": "OCA\\FullTextSearch_Elasticsearch\\Platform\\ElasticSearchPlatform",
    "app_navigation": "0",
    "provider_indexed": "{\"test_provider\":\"0\",\"deck\":\"1\",\"files\":\"1\"}",
    "cron_err_reset": "1685870708",
    "tick_ttl": "1800",
    "collection_indexing_list": "50",
    "migration_24": "1"
}
{
    "elastic_host": "http:\/\/nextcloud-aio-fulltextsearch:9200",
    "elastic_index": "nextcloud-aio",
    "fields_limit": "10000",
    "es_ver_below66": "0",
    "analyzer_tokenizer": "standard"
}
{
    "files_local": "1",
    "files_external": "0",
    "files_group_folders": "0",
    "files_encrypted": "0",
    "files_federated": "0",
    "files_size": "100",
    "files_pdf": "1",
    "files_office": "1",
    "files_image": "0",
    "files_audio": "0",
    "files_chunk_size": "2"
}
[05-Jun-2023 14:38:36] NOTICE: fpm is running, pid 464
[05-Jun-2023 14:38:36] NOTICE: ready to handle connections


Hi, are you running AIO behind a reverse proxy?

1 Like

traefik yes, but didnt change anything there, and all services are running. but here is the relevant part:

middlewares-chains.yml


chain-nextcloudaio:
      chain:
        middlewares:
          - middlewares-rate-limit
          - middlewares-https-redirectscheme
          - middlewares-secure-headers
          #- nextcloud-redirect

middlewares.yml

http:
  routers:
    nextcloud:
      rule: "Host(`sub.domain.tld`)"
      entrypoints:
        - "https"
      service: nextcloud
      middlewares:
        - chain-nextcloudaio@file
      tls:
        certresolver: "dns-cloudflare"
  services:
    nextcloud:
      loadBalancer:
        servers:
          - url: "http://server.local:11000"
  middlewares:
    middlewares-rate-limit:
      rateLimit:
        average: 100
        burst: 50
    middlewares-https-redirectscheme:
      redirectScheme:
        scheme: https
        permanent: true
    middlewares-secure-headers:
      headers:
        accessControlAllowMethods:
          - GET
          - OPTIONS
          - PUT
          - POST
          - PATCH
        accessControlAllowHeaders:
          - "*"
        accessControlAllowOriginListRegex:
          - https://.*\.domain\.tld(.*)
        accessControlAllowOriginList:
          - "*"
        accessControlMaxAge: 100
        addVaryHeader: true
        hostsProxyHeaders:
          - "X-Forwarded-Host"
        stsSeconds: 63072000
        stsIncludeSubdomains: true
        stsPreload: true
        forceSTSHeader: true
        contentTypeNosniff: true
        browserXssFilter: true
        referrerPolicy: "same-origin"
        permissionsPolicy: "camera=(), microphone=(), geolocation=(), payment=(), usb=(), vr=()"
        customResponseHeaders:
          X-Robots-Tag: "none"
          server: ""
          X-Forwarded-Proto: "https"
          Access-Control-Allow-Origin: "*"

Can you post the output of curl -v http://server.local:11000

it was a wrong hostname, changed the distro and didnt had this part in mind.

anyway, you pointed me in the right direction thanks :heart:

1 Like