1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Debug link on NGINX = Bad Gateway

Discussion in 'Troubleshooting and Problems' started by lasertits, Oct 2, 2011.

  1. lasertits

    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
    [​IMG]
    :(

    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?
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  3. lasertits

    lasertits Active Member

    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.
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Oh yeah, that little link. o_O

    Definitely check the server logs. Hopefully they will contain more information about the error.
     
  5. lasertits

    lasertits Active Member

    error_log:
    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:
    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:
     
  6. Mike

    Mike XenForo Developer Staff Member

    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).
     
  7. Luke F

    Luke F Well-Known Member

    I'm using mysqlnd and the latest php and mysql behind nginx and have never seen php processes crash.
     
  8. ankurs

    ankurs Well-Known Member

    was anyone able to fix this ?
     
  9. Spenser

    Spenser Active Member

    What php backend is used?
     
  10. ankurs

    ankurs Well-Known Member

    PHP 5.3.8 , php-fpm
     
  11. lasertits

    lasertits Active Member

    I was never able to fix this, no. PHP 5.3.8, php-fpm, nginx 1.0.10
     
  12. Deebs

    Deebs Well-Known Member

    What are your settings for the following:

    Those are mine and the debug link works fine.
     
  13. lasertits

    lasertits Active Member

    Which conf did you set those in? fastcgi_params, fastcgi.conf, nginx.conf?
     
  14. Deebs

    Deebs Well-Known Member

    They live in the http context so I keep them in nginx.conf.
     
  15. lasertits

    lasertits Active Member

    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" "-"
    
     
  16. Deebs

    Deebs Well-Known Member

    Here is my fastcgi_buffers
     
  17. lasertits

    lasertits Active Member

    Appreciate it. Going to try a few things, not having any luck thus far though. I'll update if I come across a solution.


     
  18. high1976

    high1976 Active Member

    5.3.9, php-fpm, apc and nginx 1.0.11 here, /?_debug=1 works perfectly
     

    Attached Files:

  19. Deebs

    Deebs Well-Known Member

    Did you manage to fix this?
     
  20. lasertits

    lasertits Active Member

    I installed PHP 5.3.9 yesterday and apparently that fixed the issue, whatever it was.
     
    Kyle12 likes this.

Share This Page