502 Bad Gateway openresty

Nextcloud version : 28.0.2
Operating system and version: Ubuntu 20.04.6 LTS
Apache or nginx version: 2.4.41
PHP version: 8.2.15

(Sorry in advance, I inherited this server at work and tried to upgrade it, but I am not a developer. I have spent over 10 hours running commands and troubleshooting with no luck). The issue you are facing: My container is stuck on “restarting”. I was able to upgrade to 27, but as soon as I updated to 28, I got a “502 Bad Gateway” openresty. The container wants to use port 80. I have tried following the upgrade steps: sudo -u www-data php occ upgrade, but I get this error:

PHP Warning:  require_once(/var/lib/docker/volumes/nextcloud_nextcloud-data/_data/console.php): Failed to open stream: Permission denied in /var/lib/docker/volumes/nextcloud_nextcloud-data/_data/occ on line 11
PHP Fatal error:  Uncaught Error: Failed opening required '/var/lib/docker/volumes/nextcloud_nextcloud-data/_data/console.php' (include_path='.:/usr/share/php') in /var/lib/docker/volumes/nextcloud_nextcloud-data/_data/occ:11
Stack trace:
#0 {main} thrown in /var/lib/docker/volumes/nextcloud_nextcloud-data/_data/occ on line 11

Here is the output of my “docker ps” command:

CONTAINER ID   IMAGE                             COMMAND                  CREATED         STATUS                          PORTS                                                                                  NAMES
d01ac1ad472d   jc21/nginx-proxy-manager:latest   "/init"                  4 minutes ago   Up 4 minutes                    0.0.0.0:80-81->80-81/tcp, :::80-81->80-81/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp   nextcloud_npm-app_1
a3efdafb356f   nextcloud_nextcloud-app           "/entrypoint.sh apac…"   4 minutes ago   Restarting (1) 22 seconds ago                                                                                          nextcloud_nextcloud-app_1
8814de1cb2c5   mariadb:10.5                      "docker-entrypoint.s…"   4 minutes ago   Up 4 minutes                    3306/tcp                                                                               nextcloud_nextcloud-db_1
28ec35a7d218   jc21/mariadb-aria:latest          "/scripts/run.sh"        4 minutes ago   Up 4 minutes                    3306/tcp                                                                               nextcloud_npm-db_1

Here is output of docker inspect nextcloud_nextcloud-data

[
    {
        "CreatedAt": "2024-02-23T08:56:45-08:00",
        "Driver": "local",
        "Labels": {
            "com.docker.compose.project": "nextcloud",
            "com.docker.compose.version": "1.29.2",
            "com.docker.compose.volume": "nextcloud-data"
        },
        "Mountpoint": "/var/lib/docker/volumes/nextcloud_nextcloud-data/_data",
        "Name": "nextcloud_nextcloud-data",
        "Options": null,
        "Scope": "local"
    }
]

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

Steps to replicate it:

  1. docker-compose up -d

The output of your Nextcloud log in Admin > Logging:

I cannot even figure out how to access any logs, that is part of my problem.

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

/var/lib/docker/nextcloud_nextcloud-data/_data/config/config.php

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

[Thu Feb 22 20:12:25.708190 2024] [core:notice] [pid 25246] AH00094: Command line: '/usr/sbin/apache2'
[Thu Feb 22 20:13:04.388424 2024] [mpm_prefork:notice] [pid 25246] AH00169: caught SIGTERM, shutting down
[Thu Feb 22 21:38:44.285964 2024] [mpm_prefork:notice] [pid 339723] AH00163: Apache/2.4.41 (Ubuntu) configured -- resuming normal o
2024/02/23 09:35:30 [emerg] 14535#14535: bind() to [::]:80 failed (98: Address already in use)
2024/02/23 09:35:30 [emerg] 14535#14535: still could not bind()

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.

I cannot figure out where this exists, and how to access my logs.

additionally, here is a screenshot of all the errors I got on v27 before upgrading:

edit: I think I am making progress, I ran: sudo docker logs a3efdafb356f and I get a bunch of these errors;

Can't start Nextcloud because the version of the data (28.0.2.5) is higher than the docker image version (23.0.3.2) and downgrading is not supported. Are you sure you have pulled the newest image version?

hello @dukeside welcome to the community :handshake:

you have different problem you must solve one by one. first please provide you docker-compose file.

is likely your docker named volume - more interesting would be docker inspect nextcloud_nextcloud-app (but usually compose file is enough).

which container shows this error? did you bind both nginx-proxy-manager and nextcloud-app to port 80? or maybe you just don’t have IPv6 in Docker (which is default)…

sounds you have been running NC28 in the past (or tried to upgrade to this version).

Thanks for the reply, I ended up just deleting and reinstalling from scratch, and I hopefully have everything working!

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