perusio / drupal-with-nginx

Running Drupal using nginx: an idiosyncratically crafted bleeding edge configuration.
854 stars 246 forks source link

502 Bad Gateway with unexpected fastcgi record #160

Open filmost opened 10 years ago

filmost commented 10 years ago

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

filmost commented 10 years ago

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?

sebas5384 commented 10 years ago

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?

sebas5384 commented 10 years ago

@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 :)

njt1982 commented 9 years ago

@sebas5384 Did you ever resolve this? I'm getting it locally with a Drupal 8.0b1 install.

wismoyo commented 9 years ago

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.

ttenz commented 9 years ago

I have turn on tcp and now all is ok!

njt1982 commented 8 years ago

keepalive fixes this for me too

guiajlopes commented 8 years ago

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...

perusio commented 8 years ago

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.

mustanggb commented 8 years ago

I'm still seeing this for new installs as well, the keepalive workaround still works.