Bad Gateway 502 error

Hi,

I’m trying to setup nextcloud on ODROID C2, I’m using how to from here; https://www.c-rieger.de/

I did installation 3 times already but always end on the same error. Im using fresh minimal debian jessie server.
Complete install went fine no errors. But when I try to reach nextcloud WEB page i get Bad Gateway error; Nginx error.log shows permission problems, but cant figure it out why;

here is the log;
2016/08/13 15:57:20 [crit] 2158#2158: *1 connect() to unix:/run/php/php7.0-fpm.sock failed (13: Permission denied) while connecting to upstream, client: 10.0.0.1, server: XXX.asuscomm.com, request: “GET / HTTP/1.1”, upstream: “fastcgi://unix:/run/php/php7.0-fpm.sock:”, host: "XXX.asuscomm.com"
2016/08/13 15:57:20 [crit] 2158#2158: *1 stat() “/var/www/nextcloud/favicon.ico” failed (13: Permission denied), client: 10.0.0.1, server: XXX.asuscomm.com, request: “GET /favicon.ico HTTP/1.1”, host: “XXX.asuscomm.com”, referrer: “http://XXX.asuscomm.com/

I’m able to access the page without 502 error if i change nginx user to www-data, but this is not proper way to do it.

Folder permissions;
root@DietPi:/var/www# ls -la
total 16
drwxr-xr-x 4 www-data www-data 4096 Aug 13 14:30 .
drwxr-xr-x 13 root root 4096 Aug 13 14:30 …
drwxr-xr-x 2 www-data www-data 4096 Aug 13 14:30 letsencrypt
drwxr-x— 15 www-data www-data 4096 Aug 13 15:39 nextcloud

Any suggestion what to check would be welcome.

Thanks,

Hi there,

i ran into the exact same error as you did and in fact the only way i was able to solve it was by changing nginx to the www-data user …

One more thing i can think of though: Have you checked the php-fpm configuration file in /etc/php/7.0/fpm/pool.d/www.conf? (I’m assuming you are running php7 already)

There should be a section which contains the following code snippets:
listen.owner = www-data
listen.group = www-data

It could possibly be that you have to change those lines to “nginx” in order for it to work. Then just reload nginx and php-fpm and you should be good. Not sure if it helps but maybe worth a try …

1 Like

Haven’t got the time to look into the error. You could try to run this: nextcloud_install_production.sh on your Odroid

This is a fork from the official VM for Raspberry’s (shouldnt be that much that needs to be changed for the Odroid) and its ran on a clean Ubuntu 16.04 server (or 15.x or 14.x).

We could make another branch for Odroid 64bit C2, if you send me the install logs.

Sets up a full nextcloud installation with PHP7, Redis, Letsencrypt and more, just like the official vm.

I had the same, till I noticed I had forgotten one instruction. At:
vi /etc/nginx/nginx.conf
I had forgotten to change the first line in:
user www-data;
Problem solved :slight_smile:

This is what worked for me