简体   繁体   English

Rails app迁移到AWS Elastic Beanstalk :: Bad Gateway(502)

[英]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. 因此,我正在从Heroku迁移到AWS Elastic Beanstalk并测试水域。 I'm following this documentation: 我正在关注此文档:

AWS Docs :: Deploy Rails app to AWS AWS Docs :: Deploy Rails应用程序到AWS

However after following the documentation I keep receiving a Bad Gateway 502 (error). 但是在遵循文档后,我一直收到Bad Gateway 502(错误)。

Here's the specs of my app: 这是我的应用程序的规格:

  • Rails 4.1.8 Rails 4.1.8
  • Ruby 2.1.7 Ruby 2.1.7
  • Server Puma 服务器Puma

So I checked my /log/nginx/error.log and here is what I see: 所以我检查了我的/log/nginx/error.log ,这是我看到的:

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" 2015/11/24 06:44:12 [暴击] 2689#0:* 4719 connect()到unix:///var/run/puma/my_app.sock失败(2:没有这样的文件或目录)连接到上游,客户端:172.31.13.129,服务器:_,请求:“G ET / HTTP / 1.1”,上游:“ http:// unix:///var/run/puma/my_app.sock:/ ”,主机: “my-app-env-mympay5afd.elasticbeanstalk.com”

From this AWS Forum thread it appears as though Puma is not starting correctly. 从这个AWS论坛主题看起来好像Puma没有正确启动。

So the three log files that I have taken a look at are: 所以我看过的三个日志文件是:

  • /var/log/eb-activity.log /var/log/eb-activity.log
  • /var/log/eb-commandprocessor.log /var/log/eb-commandprocessor.log
  • /var/log/eb-version-deployment.log /var/log/eb-version-deployment.log

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). 除了我修复的“secret_key_base”错误(我使用了eb setenv SECRET_KEY_BASE=[some_special_key]命令)之外,它们似乎都没有显示任何错误。

One thing that could hint at the source of the issue is /var/log/nginx/rotated/error.log1448330461.gz has the following content 可能暗示问题根源的一件事是/var/log/nginx/rotated/error.log1448330461.gz具有以下内容

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 2015/11/24 01:06:55 [警告] 2680#0:在/etc/nginx/nginx.conf:39重复MIME类型“text / html”2015/11/24 01:06:55 [warn] 2680 #0:0.0.0.0:80上冲突的服务器名称“localhost”,被忽略

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. 作为另一个参考点,我看过这个SO帖子 ,这似乎暗示我需要启用SSL才能使所有这些工作。

Thanks in advance! 提前致谢!

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. 在我的'production.rb'中,我有一个force_ssl设置,但我刚刚开始时我没有设置SSL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM