owncloud / core

:cloud: ownCloud web server core (Files, DAV, etc.)
https://owncloud.com
GNU Affero General Public License v3.0
8.38k stars 2.06k forks source link

nginx + php5-fpm results in random 502 Bad Gateway #14187

Closed laurivosandi closed 9 years ago

laurivosandi commented 9 years ago

Hello,

we just upgraded several machines to OwnCloud 8 and the result is that php5-fpm occasionally goes nuts and stops responding to nginx. There is nothing interesting in logs and we're running on Ubuntu 14.04 with default nginx and php5-fpm packages.

josh4trunks commented 9 years ago

@donSchoe nope, that was just the cause of the crashing for others. your php-fpm is showing the same symptom but is obviously crashing for a different reason.

youll want to find out what is causing your issue, and file another bug for it either here or with the php project. have you identified if your php-fpm is crashing or if it's a connection issue between nginx and php-fpm?

behdadk commented 8 years ago

I'm facing the very same problem, so far I could identify why I'm getting segfault:

debian kernel: [11031.822778] php5-fpm[9608]: segfault at 7ffc9c996fc0 ip 00007f926b456c1a sp 00007ffc9c996fb0 error 6 in libpcre.so.3.13.1[7f926b443000+6c000]

stratease commented 8 years ago

I was having a very similar issue, albeit I'm not on Owncloud, this was one of the only threads I could find illustrating solutions that I hadn't already tried. And the php version upgrade @cyking mentioned worked for me. Error free for a few days now.

Thanks!

nprokopic commented 8 years ago

I had this issue on Ubuntu 14.04 after updating packages, I was getting connect() to unix:/var/run/php5-fpm.sock failed No such file or directory) while connecting to upstream.

What solved the problem for me was appending this two lines in /etc/nginx/fastcgi_params

fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
fastcgi_param  PATH_INFO          $fastcgi_script_name;

Here is the original StackOverflow answer that saved my day http://stackoverflow.com/a/26129470/4727982.

fotastisch commented 8 years ago

Hi!

Lately, I have the same problem. The solution posted by nprokopic does not work for me... I'm using raspbian? Does anyone have ideas on how to solve it?

THX!!!

candidosales commented 8 years ago

@nprokopic Thanks :smile:

xiaooloong commented 8 years ago

I have the same problem on my vps. (centos7 openresty1.9.7.4 php5.6.21)

sertaconay commented 8 years ago

Try "php -i" in command line and see if there is any error. I had a extension causes error then i disabled it.

ghost commented 8 years ago

https://www.scalescale.com/tips/nginx/502-bad-gateway-error-using-nginx/

-> No issue in ownCloud. If you need further help ask at a nginx support channel listed here:

http://nginx.org/en/support.html

laomagege commented 8 years ago

vim /etc/php/5.6/fpm/pool.d/www.conf check the listen socket, a sub folder /php is add to the path.

listen = /run/php/php7.0-fpm.sock

so either change the listen = /run/php7.0-fpm.sock or change the nginx config file

fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;

by the way, ensure the following 3 lines in the /etc/php/5.6/fpm/pool.d/www.conf are uncommitted, otherwise the permission error will show up in the /var/log/nginx/error.log

listen.owner = www-data listen.group = www-data listen.mode = 0660

killzoms commented 8 years ago

Just want to tell you guys a little thing that your not noticing. Double check the spelling of "/var/run/php5-fpm.sock" in the file default located at "/etc/nginx/sites-available/default" "/var/run/php5-fpm.sock" is supposed to be "/var/run/php-fpm.sock" So technically it is an ownCloud Problem that I hope was fixed by the time I looked

flowl commented 8 years ago

Ownloud doesn't alter configuration... it's a problem caused by the Debian/Ubuntu php5-fpm package. The init.d script does not recreate and touch the socket correctly after reloading I think.

unhuman commented 7 years ago

I solved this after a PHP upgrade by simply deleting the .socket file and restarting services. It then worked just fine. File name is the same, size is 0, and permissions are the same, yet it made the difference.

hectorqin commented 6 years ago

https://askubuntu.com/questions/884127/16-04-lts-and-dev-shm-files-disappearing I solved this according to this link.

lock[bot] commented 5 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.