WebFaction
Community site: login faq

I keep getting this error: 502 Bad Gateway while trying to access a Rails app. What could I check?

asked 12 Jul '13, 06:28

Federico Tom...
336
accept rate: 0%


A "502 - Bad Gateway" error means that our frontend nginx webserver was unable to connect to the port your rails app is listening to and proxy requests.

You should start by making sure that your application is running. You can see that if you log into the server via ssh and use the ps command. Try for example ps -u $USER -o pid,etime,command. This will list all the id of your processes, the time that has passes since they started and the command itself.

If you do not see your rails application there, try restarting it by using the start command in its bin directory.

permanent link

answered 12 Jul '13, 09:55

iliasr ♦♦
2.1k14
accept rate: 35%

I see the application running but still I get the same error

(12 Jul '13, 09:58) Federico Tom...

If your application is running, you should make sure that it is listening for requests from our nginx to the correct port. You can use the fuser NNNN/tcp command, where NNNN is the number your app is listening according to our control panel. The fuser command's output should map the process id of your app, which you've located using the ps command earlier.

If you are still having issues, feel free to open a support ticket for us to check it.

(12 Jul '13, 10:08) iliasr ♦♦

Hi, I'm having the same problem. I followed the steps above and fuser tells me that my application is listening to PIDs belonging to an nginx master process and an nginx worker process. Should it be listening to Passenger RackApp? Is that the problem?

(20 Feb '15, 00:23) Pablo Urenda

Pablo, you should check the application logs for hints on why it is not starting, or crashing. If ngnix is running than checking the nginx logs is the next step. Fuser will report nginx, since that is what serves passenger.

(20 Feb '15, 02:17) johns
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×108

question asked: 12 Jul '13, 06:28

question was seen: 2,701 times

last updated: 20 Feb '15, 02:17

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM