drupal-with-nginx
drupal-with-nginx copied to clipboard
502 Bad Gateway with unexpected fastcgi record
I have been testing this configuration locally and I keep getting these 502 Bad Gateway. They appear to happen when there is a redirect to a URL with arguments. An example would be after user login the page redirects to "/node?q=/" which throws a 502 Bad Gate error. If I refresh the page, then it loads as it should.
Checking error logs reveals the following error message:
2014/02/25 15:34:09 [error] 18430#0: *12 upstream sent unexpected FastCGI record: 3 while reading response header from upstream, client: 127.0.0.1, server: d82.localhost, request: "GET /node?q=/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "d82.localhost", referrer: "http://d82.localhost/"
This happens with unix sockets as well.
If I revert to my old configuration then login redirects to a clean URL (/node) instead and there is no 502 error.
Can you shed some light on what area of config I should be looking at? I am using nginx 1.2.6
I notice using your configs, my redirected URLS always end up like this "/admin/content?q=/admin/content" which where I get the 502s. What controls the URL structure?
well I can confirm, something change in the past 3 or 4 month, because with new projects I'm getting this 502 bad gateways after posts for example. Things where getting better after commenting: include nginx_status_vhost.conf;
Some tip of what can be?
@perusio I made(not finished) a juju charm, using your configurations, but! the 502 thing is still happening, and I really don't know why :( Here's the code https://github.com/sebas5384/charm-drupal/blob/bash/hooks/install
Some help? please :)
@sebas5384 Did you ever resolve this? I'm getting it locally with a Drupal 8.0b1 install.
It also happened to one of my project. Error 502 often occurs at the beginning, but when in reloading, back to normal. and this happens at random but constant. I also tried various combinations of settings does not work, I finally found the discussion here: https://groups.drupal.org/node/283558#comment-1016818 and commenting out keepalive 5 in upstream_phpcgi_unix.conf fixed this 502 issue for me.
I have turn on tcp and now all is ok!
keepalive fixes this for me too
I commented the keepalive on Drupal 8 project and it solved my issues related to 502. Everyone know the origin of this issue? Should we implement it for Drupal 8 configurations? I think just comment it is not a good solution...
I have no clue. It requires some delving into it. Let's see if by next month I can setup drupal 8 and try to debug the issue.
I'm still seeing this for new installs as well, the keepalive workaround still works.