0

幫助!我對AWS和Ruby非常陌生。我最近完成了一個鐵路應用程序的撰寫,並希望部署到aws。我已成功部署它到AWS但是當我打開網頁,這表明該 502 bad gatewayRuby on Rails部署eb部署失敗,502 badgateway

日誌文件如下圖所示

------------------------------------- 
/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部署」適用所有的變化,但這是結果

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/ 

回答

0

我假定你正在運行一個Linux,並且你正在使用gedit編輯你的文件。在/ etc/nginx/sites-enabled中,它可能會留下臨時文件,例如默認〜(看〜)。

根據您的編輯器,該文件可能被命名爲.save或類似的東西。只需運行$ ls -lah即可查看哪些文件無意存在並將其刪除。

刪除這個文件,它會解決你的問題。

+0

我已經添加了列表中的問題,我不知道哪一個要刪除,它們都很重要 –

+0

其中你(〜)這個標記的文件 –

0

嘗試SSH-ING直接在實例(或第一組如果有多個實例),並安裝寶石手工

gem install ransack 

應該給予更多的線索