Nginx 502 Error Rails
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us
Rails Nginx Unicorn 502 Bad Gateway
Learn more about Stack Overflow the company Business Learn more about hiring developers or 502 bad gateway nginx rails posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow
502 Bad Gateway Nginx Passenger Rails
Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Very limited 502 Bad Gateway error in Rails unicorn rails up vote 1 down vote favorite 1 This is so weird. One of my clients has been consistently getting 502 Bad Gateway errors (without fail and in every browser), but only on one particular page of my Rails site, she can access the rest of the pages normally. Also, everybody else (including people on the same company network) can access the same page fine. Also, the production.log does nginx error log not contain any trace of an error, it says the page was rendered 200 OK. What could possibly be causing this??? EDIT: I have double-checked that other Rails errors, such as trying to call up the details of a product id that doesn't exist, result in a 404 error instead. ruby-on-rails share|improve this question asked Jun 15 '12 at 15:45 Sprachprofi 759420 A 502 may have nothing to do with your app internally, as it indicates an invalid response was received from another server while trying to process the client's request. –cdesrosiers Jun 15 '12 at 15:54 Do you have a reverse proxy (like nginx) in front of the Rails server? If so, check those logs. –Abe Voelker Jun 15 '12 at 15:54 Have you visited the client and watched the error happen in situ? –edralph Jun 18 '12 at 12:51 add a comment| 2 Answers 2 active oldest votes up vote 1 down vote accepted I found it. This was an error with page headers (session object -> cookie) getting too large. I'm using Facebook authentication and was storing the Facebook user session in the session object. For this one person, her personal
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only http://stackoverflow.com/questions/11054049/very-limited-502-bad-gateway-error-in-rails takes a minute: Sign up 502 error nginx + ruby on rails application up vote 3 down vote favorite 1 Application details : Rails 3.1.0 Ruby 1.9.2 unicorn 4.2.0 resque 1.20.0 nginx/1.0.14 redis 2.4.8 I am using active_admin gem, for all URL's getting response 200, but only one URL giving 502 error on production. rake routes : admin_links GET /admin/links(.:format) {:action=>"index", http://stackoverflow.com/questions/14825304/502-error-nginx-ruby-on-rails-application :controller=>"admin/links"} And its working on local(development). localhost log : response code 200 Started GET "/admin/links" for 127.0.0.1 at 2013-02-12 11:05:21 +0530 Processing by Admin::LinksController#index as */* Parameters: {"link"=>{}} Geokit is using the domain: localhost AdminUser Load (0.2ms) SELECT `admin_users`.* FROM `admin_users` WHERE `admin_users`.`id` = 3 LIMIT 1 (0.1ms) SELECT 1 FROM `links` LIMIT 1 OFFSET 0 (0.1ms) SELECT COUNT(*) FROM `links` (0.2ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM `links` LIMIT 10 OFFSET 0) subquery_for_count CACHE (0.0ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM `links` LIMIT 10 OFFSET 0) subquery_for_count Link Load (0.6ms) SELECT `links`.* FROM `links` ORDER BY `links`.`id` desc LIMIT 10 OFFSET 0 Link Load (6677.2ms) SELECT `links`.* FROM `links` Rendered /usr/local/rvm/gems/ruby-1.9.2-head/gems/activeadmin-0.4.2/app/views/active_admin/resource/index.html.arb (14919.0ms) Completed 200 OK in 15663ms (Views: 8835.0ms | ActiveRecord: 6682.8ms | Solr: 0.0ms) production log : 502 response Started GET "/admin/links" for 103.9.12.66 at 2013-02-12 05:25:37 +0000 Processing by Admin::LinksController#index as */* Parameters: {"link"=>{}} NGinx error log 2013/02/12 07:36:16 [error] 32401#0: *1948 upstream prematurely closed connection while reading response header from upstream don't know what's happening, could some buddy help me out. mysql rub
have one accepted answer. Are you sure you want to replace the current answer with this one? Yes, I'm sure. Changed your mind? You previously marked this answer as accepted. Are you sure https://www.digitalocean.com/community/questions/nginx-502-bad-gateway-simple-rails-app-in-centos-7-x you want to unaccept it? Yes, I'm sure. Sign Up Log In submit Tutorials Questions Projects Meetups Main Site logo-horizontal DigitalOcean Community Menu Tutorials Questions Projects Meetups Main Site Sign Up Log In submit View All Results By: frontend Subscribe Subscribed Share 0 Nginx 502 Bad Gateway simple Rails App in CentOS 7.x February 4, 2015 4.2k views In CentOS 7.x I've installed a Rails app which I can access through 502 bad [ip]:8080. It works. But when I set the domain name as a server_name (instead of localhost) I get a 502 Bad Gateway problem. I already restarted nginx. And the application is running with unicorn_rails. My rails log shows nothing. PD: This app is from this tutorial. /etc/nginx/conf.d/default.conf upstream app { # Path to Unicorn SOCK file, as defined previously server unix:/tmp/unicorn.myapp.sock fail_timeout=0; } server { listen 80; server_name mydomain.com www.mydomain.com; 502 bad gateway # Application root, as defined previously root /var/www/my_app; try_files $uri/index.html $uri @app; location @app { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_pass http://app; } error_page 500 502 503 504 /500.html; client_max_body_size 4G; keepalive_timeout 10; } 2 comments 0 asb MOD February 4, 2015 Are you seeing anything in your Nginx error logs? /var/log/nginx/error.log Generally, a 502 error means that there is a problem with the connection between the app and the proxy server. Is the app using /tmp/unicorn.myapp.sock to communicate, does it actually exist? How To Troubleshoot Common HTTP Error CodesThis guide focuses on identifying and troubleshooting the most commonly encountered HTTP error codes, i.e. 4xx and 5xx status codes, from a system administrator's perspective. There are many situations that could cause a web server to respond to a request with a particular error code--we will cover common potential causes and solutions. 0 frontend February 5, 2015 Hi @asb. No, unicorn.myapp.sock seems to be missing. [root@mydroplet tmp]# pwd /var/www/my_app/tmp [root@mydroplet tmp]# ls cache pids sessions sockets This is what my /var/log/nginx/error.log shows: (sorry for all this pasted code) 2015/02/04 13:24:58 [error] 640#0: *1 open() "/usr/share/nginx/html/tasks" failed (2: No such file or directory), , server: localhost, request: "GET /tasks HTTP/1.1", host: "my-ip" 2015/02/04 13:24:59 [error] 640#0: *1 open() "/usr/share/nginx/html/t