Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 634 Vote(s) - 3.47 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Drupal + Nginx + Php-cgi : 502 Bad Gateway error

#1
We are running Drupal 5.x on Nginx with php-fastcgi.
Things were working fine for a while. All of a sudden, we (users) are running into 502 Bad Gateway error.
Restarting PHP-cgi, nginx.. rebooting machine etc did not help.

Did anyone else run into this type of issue? What are the possible suspects?
Reply

#2

502 errors are usually caused when PHP freaks out for some reason. The first thing you should do is check all of your logfiles. That includes system stuff in /var/log/ and the nginx logs.

If you haven't made any recent changes and the problem just started happening for no apparent reason, PHP may be running out of memory. I know when it happens as an Apache module it gives a blank screen--wouldn't be surprised if a 502 error happened under nginx and the FastCGI interface. That's easy to fix by putting <b>ini_set('memory_limit', '256M')</b> into your index.php and see if that fixes the problem.

Also, can you load stand alone PHP files that don't involve Drupal? Put putting <b><?php phpinfo(); ?></b> into a file called info.php and try hitting that and see what happens.

Good luck!


Reply

#3
If the problem just started.. Read above.. if the server is new just setup, try this command to see if it's even listening on it's port

netstat -lpn | grep ":9000"

If course you could have setup fast-cgi to work on a different port, so just replace the port 9000 in that statement with what ever port you're looking for.. If nothing continues to show up, likely nothing is listening on that port and you need to fix that problem first.
Reply

#4
If you have firePHP disable it.
Big headers causes problems while nginx comunication with php
Reply

#5
Usually when I have come across this it has been a fatal error in PHP somewhere. Have a look at your PHP-cgi log to see if it is in there. There should be something in the nginx log like this: `104: Connection reset by peer`. Depending on your setup this *(sorry, link dead)* might help but if you're using [php-fpm][2] it won't.


[2]:

[To see links please register here]

Reply

#6
Today I was getting “502 Bad Gateway” on a CI project , after digging into the problem I found out it is a problem of nginx fastcgi buffers , here is how to fix it :
open /etc/nginx/nginx.conf

add the following lines into http section :

fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
Reply

#7
I got this error as well and I eventually disable all modules (non-core) and enable them one by one to see what caused the error.

Here's a easy way to [disable all non-core modules][1].


[1]:

[To see links please register here]

Reply

#8
increase your memory limit and it will be fixed. ini_set('memory_limit', '256M');
Reply

#9
It is because you probably upgraded to PHP 5.5 and therefore you now are using opcode cache which you may have enabled twice. That is check php.ini and also opcache.ini.
Reply



Forum Jump:


Users browsing this thread:
2 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through