schmudu
schmudu

Reputation: 2233

Rails app migrating to AWS Elastic Beanstalk :: Bad Gateway (502)

So I'm migrating from Heroku to AWS Elastic Beanstalk and testing out the waters. I'm following this documentation:

AWS Docs :: Deploy Rails app to AWS

However after following the documentation I keep receiving a Bad Gateway 502 (error).

Here's the specs of my app:

So I checked my /log/nginx/error.log and here is what I see:

2015/11/24 06:44:12 [crit] 2689#0: *4719 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.13.129, server: _, request: "G ET / HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/", host: "my-app-env-mympay5afd.elasticbeanstalk.com"

From this AWS Forum thread it appears as though Puma is not starting correctly.

So the three log files that I have taken a look at are:

and none of them seem to indicate any errors except for the "secret_key_base" error which I fixed (I used the eb setenv SECRET_KEY_BASE=[some_special_key] command).

One thing that could hint at the source of the issue is /var/log/nginx/rotated/error.log1448330461.gz has the following content

2015/11/24 01:06:55 [warn] 2680#0: duplicate MIME type "text/html" in /etc/nginx/nginx.conf:39 2015/11/24 01:06:55 [warn] 2680#0: conflicting server name "localhost" on 0.0.0.0:80, ignored

But they seem to be warnings rather than severe show stoppers.

Are there any other files that I should be taking a look at?

As another point of reference, I've looked at this SO Post which would seem to imply that I need to enable SSL in order for all of this to work.

Thanks in advance!

Upvotes: 4

Views: 2217

Answers (1)

schmudu
schmudu

Reputation: 2233

Got it.

In my 'production.rb' I had a force_ssl setting and I didn't set up SSL yet since I was just starting out.

Upvotes: 3

Related Questions