NextCloud - 502 Bad Gateway

  • You need to give more information than that.


    How are you launching Nextcloud?

    Which Guide did you follow to install/launch it?

  • guillaume95240

    Changed the title of the thread from “NextCloud - .htaccess not found” to “NextCloud - 502 Bad Gateway”.
  • So, if I summarize.

    I have Nextcloud with the port 450:443 and the Databace, MariaDB: 3306:3306.

    I have swag with the port 10443:443, SUBDOMAINS=wildcard, VALIDATION=duckdns and URL=xxx.duckdns.org.

    All these port are published.


    In my box, I set a NAP : Swag 10443:443. (the onlyone)


    In Swag config, I have nextcloud.subdomain.org. I don't touch anything more.

    In Nextcloud conig, i set


    What' going wrong?

    • Official Post

    well first...


    If you go to https://www.your-domain.duckdns.org


    do you get the swag page secured with a padlock?

  • Exactly, my connection is secure.

    My container Swag, Nextcloud, Nextclouddb looks working well in the logs..


    Edit:

    For Nextcloud : I have this : PHP Fatal error: Uncaught Error: Call to a member function getLogger() on null in /config/www/nextcloud/cron.php:192

    • Official Post

    Exactly, my connection is secure.

    My container Swag, Nextcloud, Nextclouddb looks working well in the logs..


    Edit:

    For Nextcloud : I have this : PHP Fatal error: Uncaught Error: Call to a member function getLogger() on null in /config/www/nextcloud/cron.php:192

    OK, so it's not swag, it's working.


    I've not seen that error... I'll try to look more into it a little bit, but a quick Google searched turned up this...


    Cron.php / Uncaught Error: Call to a member function getLogger() on null
    Nextcloud version (eg, 20.0.5): 20.0.8 Operating system and version (eg, Ubuntu 20.04): shared host (CPanel), Kernel: 3.10.0-1160.6.1.el7.x86_64 x86_64…
    help.nextcloud.com

  • Which Guide did you follow to install/launch it?

    Still didn't answered this.

    Post your YML but hide sensible DATA (password, email, domain) inside a codebox.


    And, on config.php, your overwrite host is wrong.

    The correct syntax is:

    Code
    'overwritehost' => 'nextcloud.xxx.duckdns.org', #change xxx with your domain
  • I tried several things but that's not clear it's not fixed yet..

    I install all php7.4 applications.

    I try: in /etc/php/7.4/fpm#, then nano php.ini and add apc.enable_cli=1.

    When I try This:

    Quote

    sudo -u www-data php7.4 -f /srv/dev-disk-by-uuid-f676f90c-93f5-4fdb-888e-b29ffea004f8/appdata/nextcloud/config/www/nextcloud/cron.php

    It says:

    Quote

    Cannot write into "config" directory!

    This can usually be fixed by giving the web server write access to the config directory.


    But, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it.

    I don't have ea-php7.4 for this commande: /usr/local/bin/ea-php74 for This


    Do you have an idea or how can I resolve that?




    Still didn't answered this.

    Sorry it's a bit complicated because I follow multiple tutorial. we can that one one, but without command line and for subdomain using a French Youtuber.


    Post your YML but hide sensible DATA (password, email, domain) inside a codebox.

    Of Nextcloud?

    Thanks for my conif.php!

  • Sorry it's a bit complicated because I follow multiple tutorial

    And this is what is the problem.

    Mixing things won't help in any way.

    When I try This:

    You're using Linuxserver image and the user www-data doesn't exist in it.

    The user Linuxserver uses in their images/containers is abc.

    I install all php7.4 applications.

    I try: in /etc/php/7.4/fpm#, then nano php.ini and add apc.enable_cli=1.

    Stop messing more things.

    You don't have to installing nothing or edit php.ini.

    The latest Linuxserver image doesn't even run on php7.4 anymore. It runs on php8.


    With all the mess you have in there, better to clean up the system and start fresh.


    And if you do start fresh, use a different password for the MYSQL_ROOT_PASSWORD.

    Now, every reader knows it.

  • The latest Linuxserver image doesn't even run on php7.4 anymore. It runs on php8.

    That was one of my question, php is now 8.2 but I didn't find it in my configuration, only 7.4. Is it normal or because it's the most stable version?


    I can start a configuration, it's not the first time. How can I clean up? Just for Nextcloud? Remove the Stack, images, folder in appdata?



    LOL... Well as long as me and you keep it a secret

    And i read twice.. I'm not fully awake this morning!

  • That was one of my question, php is now 8.2 but I didn't find it in my configuration, only 7.4.

    PHP 7.4 is used on the host by OMV.

    PHP 8 exists inside the container.

    They're 2 distinct things.


    How can I clean up? Just for Nextcloud? Remove the Stack, images, folder in appdata?

    If you don't have any data there, yes.


    After that is done, post the YML you used for SWAG, hiding sensible data and we'll continue.

  • Ok, so I didn't have any Nexcloud or Nexclouddb in Docker or Appdata.


    My Swag stack, I iwll use the linux server image:

  • First make sure that the old folders are non-existant:

    ls -al /srv/dev-disk-by-uuid-f676f90c-93f5-4fdb-888e-b29ffea004f8/appdata/


    Make sure that the user ID 1000 is the one you want to own Nextcloud (I recall reading you used docker1 but don't see it anymore

    id 1000

    id docker1 # If you followed macom guide, you probably made this user but it doesn't mean it's user 1000.


    Now copy/paste the code below and use it to deploy the STACK the way you feel better (with Portainer or docker-compose YML or with the openmediavault-compose)

    Just don't forget to change the PASSWORD to something else


    After deployed, open a browser with https://IP_of_OMV:450 (accept the warning for insecure connection) and do the initial configuration of Nextcloud but take care of the DATA you enter on the screen:


    On the "Create an admin account" section, write a name for the USER && PASSWORD that will be the ADMIN of Nextcloud (this USER has nothing to do with USERS on OMV. See it as a independent system):




    Leave the "Data Folder" as it is:



    On the "Configure the database" section, Select "MySQL/MariaDB" and write the fields with the info from the YML:

    Database USER == root

    Database PASS == <The password that you set on MYSQL_ROOT_PASSWORD>

    Database name == nextcloud

    Database host == nextclouddb # Instead of localhost




    Click "Finish Setup"



    After that, and it is installed, we'll go fo the rest.

  • First make sure that the old folders are non-existant:

    ls -al /srv/dev-disk-by-uuid-f676f90c-93f5-4fdb-888e-b29ffea004f8/appdata/

    I re-organize my other stack, and I use the admin account instead of auser one (which was in group root/admin/user, I will let it only user). So I got that;

    Code
    drwxr-xr-x 5 root root 49 Feb 10 12:47 .
    drwxr-xr-x 7 root root 116 Feb 7 23:50 ..
    drwxr-xr-x 2 admin users 22 Feb 10 12:47 duckdns
    drwxr-xr-x 7 admin users 111 Feb 10 12:44 heimdall
    drwxr-xr-x 11 admin users 4096 Feb 3 02:34 swag


    I add the stack, just modify my password and change PUID.


    i get an issue here,

    On the "Configure the database" section, Select "MySQL/MariaDB" and write the fields with the info from the YML:

    Database USER == root

    Database PASS == <The password that you set on MYSQL_ROOT_PASSWORD>

    Database name == nextcloud

    Database host == nextclouddb # Instead of localhost

    I get that in NextCloud:

    Code
    Error while trying to create admin user: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [1045] Access denied for user 'root'@'nextcloud.swag_default' (using password: YES)

    Is root the issue? And ir should be admin? Or my network swag_default? Because all my container are in Swag_default?

  • and I use the admin account instead of auser one

    Using HOST "admin" (id 998) is nonsense, in every aspects.

    Docker is meant to run with unpriviledge users.

    That is why a user with id => 1000 is the correct approach.


    i get an issue here,

    Since I don't use SWAG outside of the Nextcloud YML, this issue never happens.


    To fix it momentary and to simplify for now, bring down the STACK, delete the folders and edit the STACK, like this:


    Redeploy the stack.

  • Ok, I update the stacks, they are now with PUID 1000.

    Code
    drwxr-xr-x 7 root root 109 Feb 10 13:45 .
    drwxr-xr-x 7 root root 116 Feb 7 23:50 ..
    drwxr-xr-x 2 xxx users 22 Feb 10 12:47 duckdns
    drwxr-xr-x 7 xxx users 111 Feb 10 12:44 heimdall
    drwxr-xr-x 4 root root 32 Feb 10 13:45 nextcloud
    drwxr-xr-x 4 xxx users 68 Feb 10 13:45 nextclouddb
    drwxr-xr-x 11 xxx users 4096 Feb 3 02:34 swag


    Still the same issue, it seems that not the network mais the account?


    Code
    Error while trying to create admin user: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [1045] Access denied for user 'root'@'nextcloud.nextcloud_default' (using password: YES)

    Do I need to setup with the stacks with this?

    - MYSQL_DATABASE=USER_DB_NAME #optional

    - MYSQL_USER=MYSQL_USER #optional

    - MYSQL_PASSWORD=DATABASE_PASSWORD #optional

    or, do I already have an old database?

  • You need to start posting the outputs inside CODEBOX, and not on Quote, please.


    Changing the owner of a STACK on an existing deployment won't change the existing folders.

    They have to be deleted, and when the container is recreated, they will be made with the proper ownership.


    So, first, post the output of the EDITED STACK (only hide the PASSW).


    Then, the output of:

    ls -al /srv/dev-disk-by-uuid-f676f90c-93f5-4fdb-888e-b29ffea004f8/appdata/nextclouddb


    ls -al /srv/dev-disk-by-uuid-f676f90c-93f5-4fdb-888e-b29ffea004f8/appdata/nextcloud

  • Ok, I delete Nextcloud* folder and images and recreate the stack.



    for Nextcloud:

    Code
    drwxr-xr-x 4 root             root   32 Feb 10 14:26 .
    drwxr-xr-x 7 root             root  109 Feb 10 14:26 ..
    drwxr-xr-x 8 xxx  users 131 Feb 10 14:26 config
    drwxr-xr-x 2 xxx users  35 Feb 10 14:27 data

    For Nextclouddb

    Code
    drwxr-xr-x 4 xxx users   68 Feb 10 14:26 .
    drwxr-xr-x 7 root             root   109 Feb 10 14:26 ..
    -rw-r--r-- 1 xxx users 5924 Feb 10 14:26 custom.cnf
    drwxr-xr-x 5 xxx users 4096 Feb 10 14:26 databases
    drwxr-xr-x 3 xxx users   27 Feb 10 14:26 log

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!