Forum: NGINX Nginx 502 bad gateway every few seconds

2974d09ac2541e892966b762aad84943?d=identicon&s=25 lechevo (Guest)
on 2012-07-23 15:44
(Received via mailing list)
Hi


Could someone help me i get the 502 bad gateway every few seconds

The server is running on vps on debian with quadcore and 3g ram

here is the kind of error i can in the nginx log :

2012/07/23 15:06:53 [error] 2908#0: *247 recv() failed (104: Connection
reset by peer) while reading response header from upstream, client:
81.255.98.253, server: www.acmslt.fr, request: "GET
/category/culte/conferences/ HTTP/1.1", upstream:
"fastcgi://127.0.0.1:9000", host: "acmslt.fr", referrer:
"http://www.google.fr/url?sa=t&rct=j&q=mosqu%C3%A9e...
~
here is the nginx.conf



    user www-data;
    worker_processes 4;
    events {
            worker_connections 1024;
           }

    http {
         include mime.types;
         default_type application/octet-stream;

         # Hide the Nginx version number
         server_tokens off;

         # Tweeks
         sendfile on;
         tcp_nodelay off;
         tcp_nopush on;
         keepalive_timeout 5;
         client_body_timeout 10;
         client_header_timeout 10;
         send_timeout 10;
         client_max_body_size 8M;

         set_real_ip_from 127.0.0.1;
         real_ip_header X-Forwarded-For;

         gzip on;
         gzip_disable "MSIE [1-6].(?!.*SV1)";
         gzip_vary on;
         gzip_comp_level 3;
         gzip_proxied any;
         gzip_buffers 16 8k;

         include /etc/nginx/conf.d/*.conf;
         include /etc/nginx/sites-enabled/*;
      }


the website conf in the site available

    server {
            listen 8080;
            server_name www.acmslt.fr acmslt.fr;
            location / {
            root /var/www/wordpress;
            index index.php index.html index.htm;
            # Rewrite rules
            if (!-e $request_filename) {
            rewrite ^(.+)$ /index.php?q=$1 last;
           }
           # Security
           # include global/security.conf;
           # W3 Total Cache
           include global/wordpress-w3-total-cache.conf;
           # PHP-FPM
           include global/php-fpm.conf;
           }
    }

then the global/php-fpm.conf

    # PHP scripts -> PHP-FPM server listening on 127.0.0.1:9000
    location ~ \.php$ {
                       fastcgi_pass 127.0.0.1:9000;
                       fastcgi_index index.php;
                       include fastcgi_params;
                       fastcgi_connect_timeout 60;
                       fastcgi_send_timeout 180;
                       fastcgi_read_timeout 600;
                       fastcgi_temp_file_write_size 1M;
                       fastcgi_intercept_errors on;
                       fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name;
                      }

the php-fpm www.conf

    [www]
    user = www-data
    group = www-data
    listen = 127.0.0.1:9000
    pm = dynamic
    pm.max_children = 5
    pm.start_servers = 2
    pm.min_spare_servers = 1
    pm.max_spare_servers = 3
    chdir = /

Thanks

Edit here is what i can see in the php-fpm.log


here is what i can see in the php-fpm log

    [23-Jul-2012 08:13:26] NOTICE: fpm is running, pid 631
    [23-Jul-2012 08:13:26] NOTICE: ready to handle connections
    [23-Jul-2012 08:40:04] WARNING: [pool www] child 646 exited on
signal 11 (SIGSEGV)         after 1598.101386 seconds from start
    [23-Jul-2012 08:40:04] NOTICE: [pool www] child 1354 started
    [23-Jul-2012 08:40:04] WARNING: [pool www] child 1354 exited on
signal 11 (SIGSEGV) after 0.191254 seconds from start
    [23-Jul-2012 08:40:04] NOTICE: [pool www] child 1355 started
    [23-Jul-2012 08:40:20] WARNING: [pool www] child 647 exited on
signal 11 (SIGSEGV) after 1614.612810 seconds from start
    [23-Jul-2012 08:40:20] NOTICE: [pool www] child 1356 started
    [23-Jul-2012 08:41:05] NOTICE: Finishing ...
    [23-Jul-2012 08:41:05] NOTICE: exiting, bye-bye!
    [23-Jul-2012 08:41:05] NOTICE: fpm is running, pid 1937
    [23-Jul-2012 08:41:05] NOTICE: ready to handle connections
    [23-Jul-2012 08:51:43] NOTICE: Finishing ...
    [23-Jul-2012 08:51:43] NOTICE: exiting, bye-bye!
    [23-Jul-2012 08:51:43] NOTICE: fpm is running, pid 2188
    [23-Jul-2012 08:51:43] NOTICE: ready to handle connections
    [23-Jul-2012 09:01:42] WARNING: [pool www] child 3934 exited on
signal 11 (SIGSEGV) after 325.793784 seconds from start
    [23-Jul-2012 09:01:42] NOTICE: [pool www] child 3983 started
    [23-Jul-2012 09:01:44] WARNING: [pool www] child 2189 exited on
signal 11 (SIGSEGV) after 601.533647 seconds from start
    [23-Jul-2012 09:01:44] NOTICE: [pool www] child 3984 started
    [23-Jul-2012 09:01:48] WARNING: [pool www] child 2190 exited on
signal 11 (SIGSEGV) after 605.045174 seconds from start
    [23-Jul-2012 09:01:48] NOTICE: [pool www] child 3986 started
    [23-Jul-2012 09:01:55] WARNING: [pool www] child 3984 exited on
signal 11 (SIGSEGV) after 10.610551 seconds from start

Thanks

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,228869,228869#msg-228869
70428f79d070743248cee1cb55cc2fb9?d=identicon&s=25 Augusto Mecking Caringi (Guest)
on 2012-07-23 15:56
(Received via mailing list)
On Mon, Jul 23, 2012 at 10:43 AM, lechevo <nginx-forum@nginx.us> wrote:
> Hi
>
>
> Could someone help me i get the 502 bad gateway every few seconds
>
> The server is running on vps on debian with quadcore and 3g ram

I think that the problem isn't in Nginx.

There are a lot of PHP-FPM crashes in de PHP-FPM log...

Take a look in the changelog of the lastest PHP version:

http://php.net/ChangeLog-5.php

There are a few PHP-FPM related bugs fixed.

>
>          default_type application/octet-stream;
>          client_header_timeout 10;
>          gzip_proxied any;
>             listen 8080;
>            # W3 Total Cache
>                        fastcgi_pass 127.0.0.1:9000;
>
>     pm.max_spare_servers = 3
>     [23-Jul-2012 08:13:26] NOTICE: ready to handle connections
>     [23-Jul-2012 08:41:05] NOTICE: exiting, bye-bye!
> signal 11 (SIGSEGV) after 601.533647 seconds from start
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx



--
Augusto Mecking Caringi
2974d09ac2541e892966b762aad84943?d=identicon&s=25 lechevo (Guest)
on 2012-07-23 18:54
(Received via mailing list)
Hi
thanks
i have update php to 5.4.5.1 and now i get always the 502 error
here is the log
*1 connect() failed (111: Connection refused) while connecting to
upstream,

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,228869,228887#msg-228887
70428f79d070743248cee1cb55cc2fb9?d=identicon&s=25 Augusto Mecking Caringi (Guest)
on 2012-07-23 21:12
(Received via mailing list)
On Mon, Jul 23, 2012 at 1:53 PM, lechevo <nginx-forum@nginx.us> wrote:
> Hi
> thanks
> i have update php to 5.4.5.1 and now i get always the 502 error
> here is the log
> *1 connect() failed (111: Connection refused) while connecting to
> upstream,

Now seems like a configuration problem...

The Nginx server isn't connecting to PHP-FPM.

How the Nginx <-> PHP-FPM connection is made?

--
Augusto Mecking Caringi
2974d09ac2541e892966b762aad84943?d=identicon&s=25 lechevo (Guest)
on 2012-07-23 22:27
(Received via mailing list)
Hi

thanks

Tell me wich file you want to see ?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,228869,228907#msg-228907
2974d09ac2541e892966b762aad84943?d=identicon&s=25 antoine2223 (Guest)
on 2012-11-02 13:48
(Received via mailing list)
can say it please i am really blocked .

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,228869,232453#msg-232453
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.