Debug link on NGINX = Bad Gateway

lasertits

Active member
My server is running nginx with php-fpm. I have debug enabled but whenever I go to click the link (http://site.com/?_debug=1) I just get hit with
FozOu.png

:(

Current config for the host:

Code:
        # web :: main server:
        server {
                server_name web;
                listen 80;
                listen 443 default ssl;

                access_log /var/www/logs/access_log main;
                error_log /var/www/logs/error_log info;

                root /var/www/htdocs;

                # private dirs:
                location ~ ^/(internal_data|library)/(.*)$ {
                    internal;
                }

                # clean urls:
                try_files $uri $uri/ /index.php?$uri&$args;

                location ~ .*.php$ {
                        fastcgi_pass unix:/etc/nginx/fcgi.socket;
                        fastcgi_index index.php;
              }
        }

any ideas? Perhaps something with fastcgi_index?
 
It's the link that appears in the footer if you enable debugging in your Xen config.php and as far as I know is the only link the bad gateway message appears on.

Thanks for the links, I'll give them a read and see if I come up with a solution. I'll update this thread later depending on the outcome.

If anyone else has any ideas please don't hesitate to post, I'll still be watching this spot as I troubleshoot. Thanks.
 
It's the link that appears in the footer if you enable debugging in your Xen config.php and as far as I know is the only link the bad gateway message appears on.

Oh yeah, that little link. O_o

Definitely check the server logs. Hopefully they will contain more information about the error.
 
error_log:
Rich (BB code):
2011/10/02 23:18:02 [error] 4745#0: *8 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: x.x.x.x, server: -snip-.com, request: "GET /?_debug=1 HTTP/1.1", upstream: "fastcgi://unix:/etc/nginx/fcgi.socket:", host: "-snip-.com", referrer: "http://-snip-.com/"
^ This occurs on every load / refresh.

access_log:
Rich (BB code):
x.x.x.x - - [02/Oct/2011:23:18:02 -0500]  "GET /?_debug=1 HTTP/1.1" 502 340 "http://-snip-.com/" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1" "-"

I suppose at this point I can probably take this to another site/forum and get feedback as well as it doesn't appear to be Xen specific, but rather to do with my fastcgi setup... :confused:
 
I would bet that PHP is crashing. Kier has actually started seeing that at times (I haven't and this is the only other report of it), but it's somewhat random. It was triggered by the "EXPLAIN" queries, but I really don't know why. Could try a more recent PHP version (and possibly try a different MySQL library with PHP, like mysqlnd or the standard libmysql).
 
I would bet that PHP is crashing. Kier has actually started seeing that at times (I haven't and this is the only other report of it), but it's somewhat random. It was triggered by the "EXPLAIN" queries, but I really don't know why. Could try a more recent PHP version (and possibly try a different MySQL library with PHP, like mysqlnd or the standard libmysql).

I'm using mysqlnd and the latest php and mysql behind nginx and have never seen php processes crash.
 
They live in the http context so I keep them in nginx.conf.
My nginx doesn't like that. :(
Code:
Black Cloud nginx # /etc/init.d/nginx restart
* Checking nginx' configuration ...
nginx: [emerg] "fastcgi_busy_buffers_size" must be less than the size of all "fastcgi_buffers" minus one buffer in /etc/nginx/nginx.conf:222
nginx: configuration file /etc/nginx/nginx.conf test failed
nginx: [emerg] "fastcgi_busy_buffers_size" must be less than the size of all "fastcgi_buffers" minus one buffer in /etc/nginx/nginx.conf:222
nginx: configuration file /etc/nginx/nginx.conf test failed
* failed, please correct errors above                                                                                                                                              [ !! ]
* ERROR: nginx failed to stop

While we're at it, mind sharing your location ~ .*.php$ { }?

Code:
                location ~ .*.php$ {
                        include /etc/nginx/fastcgi.conf;
                        fastcgi_pass unix:/etc/nginx/fcgi.socket;
                        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
                        include        fastcgi_params;
                        fastcgi_index index.php;
                        }
 
              }

Thanks.

Edit: I commented out the busy_buffers line for now, got nginx to restart, reloaded the debug link and I'm still hit with 502 bad gateway. Snagged the error_log, this is what it says:

Code:
2012/01/14 02:44:16 [error] 30589#0: *4 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: x.x.x.x, server: -snip-, request: "GET /?_debug=1 HTTP/1.1", upstream: "fastcgi://unix:/etc/nginx/fcgi.socket:", host: "-snip-"

Which is the same error I got before.

And the access_log:
Code:
x.x.x.x - - [14/Jan/2012:02:44:16 -0600] "GET /?_debug=1 HTTP/1.1" 502 341 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1" "-"
 
My nginx doesn't like that. :(
Code:
Black Cloud nginx # /etc/init.d/nginx restart
* Checking nginx' configuration ...
nginx: [emerg] "fastcgi_busy_buffers_size" must be less than the size of all "fastcgi_buffers" minus one buffer in /etc/nginx/nginx.conf:222
nginx: configuration file /etc/nginx/nginx.conf test failed
nginx: [emerg] "fastcgi_busy_buffers_size" must be less than the size of all "fastcgi_buffers" minus one buffer in /etc/nginx/nginx.conf:222
nginx: configuration file /etc/nginx/nginx.conf test failed
* failed, please correct errors above                                                                                                                                              [ !! ]
* ERROR: nginx failed to stop

While we're at it, mind sharing your location ~ .*.php$ { }?

Code:
                location ~ .*.php$ {
                        include /etc/nginx/fastcgi.conf;
                        fastcgi_pass unix:/etc/nginx/fcgi.socket;
                        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
                        include        fastcgi_params;
                        fastcgi_index index.php;
                        }
 
              }

Thanks.
Here is my fastcgi_buffers
fastcgi_buffers 1024 4k;

location ~ \.php$ {

try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;

include /usr/local/nginx/conf/fastcgi_params;

fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name;

# Allow nginx to do file uploads
client_body_temp_path /var/tmp/nginxuploads;
client_max_body_size 1G;
fastcgi_pass_request_body on;
fastcgi_param REQUEST_BODY_FILE $request_body_file;

fastcgi_param HTTPS on;
fastcgi_param X_FORWARDED_PROTO https;

fastcgi_pass phpfpm_backend;
}
 
Top Bottom