NextCloud 502s on install (Nginx) Topic is solved

Having issues with your DietPi installation, or, found a bug? Post it here.
Doq
Posts: 9
Joined: Sun Apr 19, 2020 1:56 am

NextCloud 502s on install (Nginx)

Post by Doq »

Okay I had accidentally closed this tab so I apologise if this is short or I'm missing anything.

I just installed Nextcloud on my production DietPi installation. However, after rebooting as it had requested and navigating to http://this.is.an.ip/nextcloud, I get a 502 error from Nginx (my httpd of choice). I hadn't done any configuration between installing Nextcloud and going to the page (just the reboot) so I'm wondering if it's my existing Nginx configuration that might be causing issues.

It's not directly integrated into nginx.conf (it's loaded as an include in a separate file).
User avatar
Joulinar
Posts: 2068
Joined: Sat Nov 16, 2019 12:49 am

Re: NextCloud 502s on install (Nginx)

Post by Joulinar »

Hi,

many thanks for your report. I did a small test an my RPi3B+ and changed default web server to nginx and installed NextCloud from dietpi-software catalogue. For me this is working fine and I can open NextCloud Login page without issues. I did not do any config changes. I just install NextCloud.

The last comment I don't understand. What do you like to say?
It's not directly integrated into nginx.conf (it's loaded as an include in a separate file).
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Doq
Posts: 9
Joined: Sun Apr 19, 2020 1:56 am

Re: NextCloud 502s on install (Nginx)

Post by Doq »

I was trying to portray that the extra config isn't in the nginx.conf directly, instead parsed separately by include (as shown below).

Code: Select all

...

http {

# Load old Eizen config
include /etc/nginx/nginx-eizen.conf;

        server_names_hash_bucket_size 64;
        charset utf-8;

        # + Nginx - To avoid 2MB upload error: https://github.com/MichaIng/DietPi/issues/546
        client_max_body_size 2047M;
        
...
User avatar
Joulinar
Posts: 2068
Joined: Sat Nov 16, 2019 12:49 am

Re: NextCloud 502s on install (Nginx)

Post by Joulinar »

Still I don't know what you trying to point out.

Nextcloud config for nginx is located at /etc/nginx/sites-dietpi/dietpi-nextcloud.conf and in general config files are spread over various directories and taken together by a couple of include

Code: Select all

root@DietPi3:/etc/nginx# cat nginx.conf|grep include
        include /etc/nginx/modules-enabled/*.conf;
        include mime.types;
        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;

Code: Select all

root@DietPi3:/etc/nginx# ls -al|grep sites
drwxr-xr-x  2 root root 4096 Apr 19 15:06 sites-available
drwxr-xr-x  2 root root 4096 Apr 19 15:06 sites-dietpi
drwxr-xr-x  2 root root 4096 Apr 19 15:01 sites-enabled
and you get a http 502, means bad gateway. do you access nextcloud directly via IP or some DDNS name?
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Doq
Posts: 9
Joined: Sun Apr 19, 2020 1:56 am

Re: NextCloud 502s on install (Nginx)

Post by Doq »

My conf also contains these includes (along with the extra include), and the directory structure produced by ls -al|grep sites.
Joulinar wrote: Sun Apr 19, 2020 8:39 pm and you get a http 502, means bad gateway. do you access nextcloud directly via IP or some DDNS name?
I have attempted both direct IP access and the fqdn assigned by the DNS server here (which matches the hostname of the machine); both produce the same result. Even tried curling it locally on the machine (also a Pi3b+) to no avail.
User avatar
Joulinar
Posts: 2068
Joined: Sat Nov 16, 2019 12:49 am

Re: NextCloud 502s on install (Nginx)

Post by Joulinar »

So you added something to the config files?
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Doq
Posts: 9
Joined: Sun Apr 19, 2020 1:56 am

Re: NextCloud 502s on install (Nginx)

Post by Doq »

Correct. I had added the line include nginx-eizen.conf (and only this line) as I moved and adapted the old production site configuration to this machine.

For completeness, I commented out this line, reloaded nginx, and the problem is not resolved.
User avatar
Joulinar
Posts: 2068
Joined: Sat Nov 16, 2019 12:49 am

Re: NextCloud 502s on install (Nginx)

Post by Joulinar »

You restarted the whole system after you excluded the whole line? Just to be sure. ;)
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Doq
Posts: 9
Joined: Sun Apr 19, 2020 1:56 am

Re: NextCloud 502s on install (Nginx)

Post by Doq »

Confirmed. This resulted in the same issue.
User avatar
Joulinar
Posts: 2068
Joined: Sat Nov 16, 2019 12:49 am

Re: NextCloud 502s on install (Nginx)

Post by Joulinar »

what happen if you just enter http://your.ip/ Does it give the Bad Gateway message as well?

Usually a 502 Bad Gateway error means that the web server you’ve connected to is acting as a proxy for relaying information from another server, but it has gotten a bad response from that other server. Which is strange, as on standard setup nginx will not act as proxy. Or did you configure something like this?

anything visible on the nginx error.log file?

Code: Select all

cat /var/log/nginx/error.log
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Post Reply