1

帮助!我对 AWS 和 Ruby 非常陌生。我最近完成了一个铁路应用程序并想部署到 aws。我已成功将其部署到 aws 但一旦我打开网站,它就会显示这个 502 bad gateway

日志文件如下所示

-------------------------------------
/var/log/nginx/error.log
-------------------------------------
2017/10/09 05:32:35 [warn] 2982#0: conflicting server name "localhost" on 0.0.0.0:80, ignored
2017/10/09 05:34:52 [crit] 2986#0: *11 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.31.26, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/", host: "production.mmwu8membg.ap-southeast-1.elasticbeanstalk.com"
2017/10/09 05:34:52 [crit] 2986#0: *11 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.31.26, server: _, request: "GET /favicon.ico HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/favicon.ico", host: "production.mmwu8membg.ap-southeast-1.elasticbeanstalk.com", referrer: "http://production.mmwu8membg.ap-southeast-1.elasticbeanstalk.com/"
2017/10/09 05:36:48 [crit] 2986#0: *40 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.31.26, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/", host: "production.mmwu8membg.ap-southeast-1.elasticbeanstalk.com"
2017/10/09 05:36:48 [crit] 2986#0: *40 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.31.26, server: _, request: "GET /favicon.ico HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/favicon.ico", host: "production.mmwu8membg.ap-southeast-1.elasticbeanstalk.com", referrer: "http://production.mmwu8membg.ap-southeast-1.elasticbeanstalk.com/"
2017/10/09 05:37:08 [crit] 2986#0: *40 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.31.26, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/", host: "production.mmwu8membg.ap-southeast-1.elasticbeanstalk.com"
2017/10/09 05:37:08 [crit] 2986#0: *40 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.31.26, server: _, request: "GET /favicon.ico HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/favicon.ico", host: "production.mmwu8membg.ap-southeast-1.elasticbeanstalk.com", referrer: "http://production.mmwu8membg.ap-southeast-1.elasticbeanstalk.com/"
2017/10/09 05:39:56 [crit] 2986#0: *109 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.12.115, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/", host: "production.mmwu8membg.ap-southeast-1.elasticbeanstalk.com"
2017/10/09 05:39:56 [crit] 2986#0: *109 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.12.115, server: _, request: "GET /favicon.ico HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/favicon.ico", host: "production.mmwu8membg.ap-southeast-1.elasticbeanstalk.com", referrer: "http://production.mmwu8membg.ap-southeast-1.elasticbeanstalk.com/"
2017/10/09 05:45:29 [crit] 2986#0: *190 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.31.26, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/", host: "production.mmwu8membg.ap-southeast-1.elasticbeanstalk.com"
2017/10/09 05:45:29 [crit] 2986#0: *190 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.31.26, server: _, request: "GET /favicon.ico HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/favicon.ico", host: "production.mmwu8membg.ap-southeast-1.elasticbeanstalk.com", referrer: "http://production.mmwu8membg.ap-southeast-1.elasticbeanstalk.com/"
2017/10/09 05:47:03 [crit] 2986#0: *215 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.31.26, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/", host: "production.mmwu8membg.ap-southeast-1.elasticbeanstalk.com"
2017/10/09 05:47:03 [crit] 2986#0: *215 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.31.26, server: _, request: "GET /favicon.ico HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/favicon.ico", host: "production.mmwu8membg.ap-southeast-1.elasticbeanstalk.com", referrer: "http://production.mmwu8membg.ap-southeast-1.elasticbeanstalk.com/"
2017/10/09 05:49:33 [crit] 2986#0: *257 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.31.26, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/", host: "production.mmwu8membg.ap-southeast-1.elasticbeanstalk.com"
2017/10/09 05:49:33 [crit] 2986#0: *257 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.31.26, server: _, request: "GET /favicon.ico HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/favicon.ico", host: "production.mmwu8membg.ap-southeast-1.elasticbeanstalk.com", referrer: "http://production.mmwu8membg.ap-southeast-1.elasticbeanstalk.com/"
2017/10/09 05:57:44 [crit] 2986#0: *382 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.31.26, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/", host: "production.mmwu8membg.ap-southeast-1.elasticbeanstalk.com"
2017/10/09 05:57:44 [crit] 2986#0: *382 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.31.26, server: _, request: "GET /favicon.ico HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/favicon.ico", host: "production.mmwu8membg.ap-southeast-1.elasticbeanstalk.com", referrer: "http://production.mmwu8membg.ap-southeast-1.elasticbeanstalk.com/"
2017/10/09 06:01:04 [crit] 2986#0: *433 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.31.26, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/", host: "production.mmwu8membg.ap-southeast-1.elasticbeanstalk.com"
2017/10/09 06:01:05 [crit] 2986#0: *433 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.31.26, server: _, request: "GET /favicon.ico HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/favicon.ico", host: "production.mmwu8membg.ap-southeast-1.elasticbeanstalk.com", referrer: "http://production.mmwu8membg.ap-southeast-1.elasticbeanstalk.com/"
2017/10/09 06:41:06 [crit] 2986#0: *1004 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.12.115, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/", host: "production.mmwu8membg.ap-southeast-1.elasticbeanstalk.com"
2017/10/09 06:55:29 [crit] 2986#0: *1204 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.31.26, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/", host: "production.mmwu8membg.ap-southeast-1.elasticbeanstalk.com"
2017/10/09 06:55:29 [crit] 2986#0: *1204 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.31.26, server: _, request: "GET /favicon.ico HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/favicon.ico", host: "production.mmwu8membg.ap-southeast-1.elasticbeanstalk.com", referrer: "http://production.mmwu8membg.ap-southeast-1.elasticbeanstalk.com/"
2017/10/09 06:56:53 [crit] 2986#0: *1232 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.31.26, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/", host: "production.mmwu8membg.ap-southeast-1.elasticbeanstalk.com"

我不知道怎么了...

我要进行一些修改,所以我按照教程进行操作。它说我可以输入命令“eb deploy”来应用所有更改,但这就是结果

damonchan:~/workspace (to_testing_site) $ eb deploy
WARNING: You have uncommitted changes.
Creating application version archive "app-489a-171009_065119".
Uploading: [##################################################] 100% Done...
INFO: Environment update is starting.                               
INFO: Deploying new version to instance(s).                         
ERROR: [Instance: i-0ed9a5088003a693c] Command failed on instance. Return code: 11 Output: (TRUNCATED)...: command `git clone
'git://github.com/activerecord-hackery/ransack.git'
"/opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/cache/bundler/git/ransack-ed28102a2b46bd0d8ac98ce8cee4fd3d73f75680"
--bare --no-hardlinks --quiet` in directory /var/app/ondeck has failed. 
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
INFO: Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
ERROR: Unsuccessful command execution on instance id(s) 'i-0ed9a5088003a693c'. Aborting the operation.
ERROR: Failed to deploy application.                                

ERROR: Failed to deploy application.

这是我的宝石

source 'https://rubygems.org'

gem 'rails',        '5.0.1'
gem 'faker',          '1.6.6'
gem 'will_paginate',  '3.1.0'
gem 'bootstrap-will_paginate', '0.0.10'
gem 'bcrypt',         '3.1.11'
gem 'bootstrap-sass', '3.3.6'
gem 'puma',         '3.4.0'
gem 'sass-rails',   '5.0.6'
gem 'uglifier',     '3.0.0'
gem 'coffee-rails', '4.2.1'
gem 'jquery-rails', '4.1.1'
gem 'turbolinks',   '5.0.1'
gem 'jbuilder',     '2.4.1'
gem 'simple_form'
gem 'validates_timeliness', '~> 4.0' # validate time 
gem 'ransack' # for search function
gem 'enum_help' # for enum in form
gem 'thinreports' #for thinreport
gem 'thinreports-rails'
gem "paperclip", "~> 5.0.0" # for image upload
gem 'jquery-ui-rails'
gem 'jquery-turbolinks'
gem 'odf-report'
gem 'rubyXL'
gem 'foundation-icons-sass-rails'
gem 'momentjs-rails'
gem 'bootstrap3-datetimepicker-rails'
gem "font-awesome-rails"
gem "simple_calendar", "~> 2.0"
gem 'whenever', :require => false

group :development, :test do
  gem 'sqlite3', '1.3.12'
  gem 'byebug',  '9.0.0', platform: :mri

end

group :development do
  gem 'web-console',           '3.1.1'
  gem 'listen',                '3.0.8'
  gem 'spring',                '1.7.2'
  gem 'spring-watcher-listen', '2.0.0'
end

group :test do
  gem 'rails-controller-testing', '0.1.1'
  gem 'minitest-reporters',       '1.1.9'
  gem 'guard',                    '2.13.0'
  gem 'guard-minitest',           '2.4.4'
end

group :production do
  gem 'pg', '0.18.4'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

这是清单

damonchan:~/workspace (to_testing_site) $ ls -lah
total 96K
drwxr-xr-x 25 ubuntu ubuntu 4.0K Oct  9 04:05 ./
drwxr-xr-x 43 ubuntu ubuntu 4.0K Oct  9 03:48 ../
drwxr-xr-x  3 ubuntu ubuntu 4.0K May 22 05:21 .c9/
drwxr-xr-x  2 ubuntu ubuntu 4.0K Oct  9 06:52 .elasticbeanstalk/
drwxr-xr-x  8 ubuntu ubuntu 4.0K Oct  9 09:07 .git/
-rw-r--r--  1 ubuntu ubuntu  711 Oct  9 09:38 .gitignore
-rw-r--r--  1 ubuntu ubuntu 1.6K Oct  9 04:42 Gemfile
-rw-r--r--  1 ubuntu ubuntu 7.6K Oct  9 06:40 Gemfile.lock
-rw-r--r--  1 ubuntu ubuntu 1.9K Oct  9 04:05 Guardfile
-rw-r--r--  1 ubuntu ubuntu   22 Oct  9 04:05 README.md
-rw-r--r--  1 ubuntu ubuntu  478 Oct  9 04:05 README.rdoc
-rw-r--r--  1 ubuntu ubuntu  249 Oct  9 04:05 Rakefile
drwxr-xr-x 17 ubuntu ubuntu 4.0K Oct  9 04:05 app/
drwxr-xr-x  2 ubuntu ubuntu 4.0K Oct  9 04:05 bin/
drwxr-xr-x  5 ubuntu ubuntu 4.0K Oct  9 04:05 config/
-rw-r--r--  1 ubuntu ubuntu  153 Oct  9 04:05 config.ru
drwxr-xr-x  3 ubuntu ubuntu 4.0K Oct  9 06:58 db/
drwxr-xr-x  5 ubuntu ubuntu 4.0K Oct  9 04:05 lib/
drwxr-xr-x  2 ubuntu ubuntu 4.0K Oct  9 04:05 log/
drwxr-xr-x  4 ubuntu ubuntu 4.0K Oct  9 04:05 public/
drwxr-xr-x 14 ubuntu ubuntu 4.0K Oct  9 04:05 test/
drwxr-xr-x  6 ubuntu ubuntu 4.0K May 23 03:43 tmp/
drwxr-xr-x  3 ubuntu ubuntu 4.0K Oct  9 04:05 vendor/
4

2 回答 2

0

我假设您正在运行 Linux,并且您正在使用 gedit 来编辑文件。在 /etc/nginx/sites-enabled 中,它可能留下了一个临时文件,例如 default~(注意 ~)。

根据您的编辑器,该文件可以命名为 .save 或类似名称。只需运行 $ ls -lah 即可查看哪些文件不存在并删除它们。

删除此文件,它将解决您的问题。

于 2017-10-09T09:24:40.777 回答
0

直接在实例上尝试 SSH-ing(如果有多个实例,则为组中的第一个)并手动安装 gem

gem install ransack

它应该提供更多线索

于 2017-10-09T12:19:08.290 回答