After few days of server running fine with nginx it start throwing 499 and 502

Posted by Abhay Kumar on Server Fault See other posts from Server Fault or by Abhay Kumar
Published on 2014-08-23T03:36:02Z Indexed on 2014/08/23 4:21 UTC
Read the original article Hit count: 233

Filed under:
|
|

Nginx start throwing 499 and 502 after running fine for few days, website is a rails app using thin as the webserver. Restarting the Nginx doent not seem to help. Below the the Nginx config

Nginx config under sites-enabled

upstream domain1 {
    least_conn;
    server 127.0.0.1:3009;
    server 127.0.0.1:3010;
    server 127.0.0.1:3011;
}

server {
        listen   80; # default_server;
        server_name xyz.com *.xyz.com;
        client_max_body_size 5M;
        access_log /home/ubuntu/www/xyz/current/log/access.log;
        root   /home/ubuntu/www/xyz/current/public/;
        index  index.html;

        location / {
                      proxy_set_header  X-Real-IP  $remote_addr;
                      proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
                      proxy_set_header Host $http_host;
                      proxy_redirect off;
                      proxy_read_timeout 150;

                      if (!-f $request_filename) {
                                       proxy_pass http://domain1;
                                       break;
                      }
        }

}

© Server Fault or respective owner

Related posts about nginx

Related posts about ruby-on-rails