Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
429 views
in Technique[技术] by (71.8m points)

Ruby On Rails 502 Bad Gateway with no nginx installed passenger

I had a Rails app running on my computer locally(localhost:3000). I just updated from rails 5.0 to 5.1 and now when I run rails s I'm getting a 502 Bad Gateway nginx/1.14.0.

=> Booting Passenger application server
=> Rails 5.1.7 application starting in production on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=============== Phusion Passenger Standalone web server started ===============
PID file: /mnt/c/Users/Username/Desktop/Projects/2. Web Applications/WebSite/tmp/pids/passenger.3000.pid
Log file: /mnt/c/Users/Username/Desktop/Projects/2. Web Applications/WebSite/log/passenger.3000.log
Environment: production
Accessible via: http://0.0.0.0:3000/

I don't ever remember having to set up Nginx to run a rails app on my computer locally before. I also recall it usually started on http://localhost:3000 or http://127.0.0.1:3000.

Here's my Gemfile:

source 'https://rubygems.org'
ruby '2.6.5'
gem 'rails', '~> 5.1.0'

gem 'active_model_serializers'
gem 'acts_as_list'
gem 'autoprefixer-rails'  # Parse CSS and add vendor prefixes to CSS rules
gem 'bootstrap3-datetimepicker-rails', '~> 4.17.47'
gem 'bootstrap-sass', '~> 3.4.1'
gem 'bitly'  # shorten or expand URLs
gem 'carrierwave', '~> 2.0'  # Upload files
gem 'carrierwave-aws'
gem 'carrierwave-base64'
gem 'carrierwave_backgrounder', :github => 'lardawge/carrierwave_backgrounder'
gem 'cocoon'  # nested forms handling (jQuery)
gem 'coffee-rails', '>= 4.2.2'  # For .coffee assets and views
gem 'devise', '~> 4.2'  # Security
gem 'faraday'  # HTTP/REST API client library
gem 'faraday-cookie_jar'
gem 'figaro', '~> 1.1', '>= 1.1.1'  # Use for environment variables (aka. passwords)
gem "fog-aws"
gem "fog"  # Ruby cloud services library
gem 'font-awesome-sass', '4.7.0'
gem 'friendly_id', '~> 5.4.0'  # slugging and permalink
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'json'  # Use for api tokens
gem 'jwt'  # Use for api tokens
gem 'knock'  # Use for api tokens
gem 'mail_form', '~> 1.5', '>= 1.5.1'
gem "mini_magick", ">= 4.9.4"
gem 'mini_racer'  # JavaScript engine
gem 'momentjs-rails', '>= 2.9.0'
gem 'nokogiri', '~> 1.10.4'  # HTML parsing # '~> 5.3', '>= 5.3.2'
gem 'passenger', '>= 5.3.2', require: 'phusion_passenger/rack_handler' 
gem 'popper_js', '~> 1.12.9'
gem 'rails_real_favicon'
gem 'recursive-open-struct'
gem 'redcarpet', '~> 3.3.4'
gem 'responders', '~> 2.0'
gem 'rest-client', '~> 1.8'
gem 'sass-rails'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'select2-rails'
gem 'sendgrid-actionmailer'
gem 'sidekiq'  # Handle background jobs
gem 'sinatra'
gem 'sprockets', '~> 4.0'  # Compiling and serving web assets
gem 'sqlite3'  # Database connection
gem 'stripe'  # Payments
gem 'turbolinks', '~> 5.1.0'
gem 'twitter', '~> 6.1'
gem 'uglifier', '>= 1.3.0'  # Compressor for JavaScript assets


group :assets do
  gem 'compass-rails'  # Add any compass extensions here
end


group :development, :test do
  gem 'byebug'  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'pry-rails'
  # gem 'puma'
  # gem 'capistrano' # For deployment
  # gem 'capistrano-rails'
  # gem 'capistrano-passenger'
  # gem 'capistrano-rbenv'
end


group :development do
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 3.0'
  gem 'capistrano-figaro-yml', '~> 1.0.2'
  gem 'solargraph'
  gem 'spring'  # Keep application running in the background. Read more: https://github.com/rails/spring
end


group :production, :staging do
  gem 'mysql2', '~> 0.4.2'
  gem 'capistrano' # For deployment
  gem 'capistrano-rails'
  gem 'capistrano-passenger'
  gem 'capistrano-bundler'
  gem 'capistrano-rbenv'
  gem 'rails_12factor'
end

Any suggestions would be super helpful. If more information is needed let me know.

Thanks.

UPDATE:

Restarting my machine got rid of the 502 error (guess "turning it off and on again" did work, thanks IT gods).

However, now I'm getting another error:

ActionView::Template::Error (undefined method `start_with?' for #<Proc:0x00007ffffa26f3c0>):
127.0.0.1 - - [25/Jan/2021:09:24:23 EST] "GET / HTTP/1.1" 500 0
- -> /
127.0.0.1 - - [25/Jan/2021:09:24:24 EST] "GET /favicon.ico HTTP/1.1" 200 0
http://localhost:3000/ -> /favicon.ico
Started GET "/service-worker.js" for 127.0.0.1 at 2021-01-25 09:24:25 -0500
  
ActionController::RoutingError (No route matches [GET] "/service-worker.js"):

actionpack (5.1.7) lib/action_dispatch/middleware/debug_exceptions.rb:63:in `call'
web-console (3.7.0) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.7.0) lib/web_console/middleware.rb:30:in `block in call'
web-console (3.7.0) lib/web_console/middleware.rb:20:in `catch'
web-console (3.7.0) lib/web_console/middleware.rb:20:in `call'
actionpack (5.1.7) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.1.7) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.1.7) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.1.7) lib/active_support/tagged_logging.rb:69:in `block in tagged'
activesupport (5.1.7) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.1.7) lib/active_support/tagged_logging.rb:69:in `tagged'
railties (5.1.7) lib/rails/rack/logger.rb:24:in `call'
actionpack (5.1.7) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
actionpack (5.1.7) lib/action_dispatch/middleware/request_id.rb:25:in `call'
rack (2.2.3) lib/rack/method_override.rb:24:in `call'
rack (2.2.3) lib/rack/runtime.rb:22:in `call'
activesupport (5.1.7) lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
actionpack (5.1.7) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.1.7) lib/action_dispatch/middleware/static.rb:125:in `call'
rack (2.2.3) lib/rack/sendfile.rb:110:in `call'
railties (5.1.7) lib/rails/engine.rb:522:in `call'
rack (2.2.3) lib/rack/handler/webrick.rb:95:in `service'
/home/corey/.rbenv/versions/2.6.5/lib/ruby/2.6.0/webrick/httpserver.rb:140:in `service'
/home/corey/.rbenv/versions/2.6.5/lib/ruby/2.6.0/webrick/httpserver.rb:96:in `run'
/home/corey/.rbenv/versions/2.6.5/lib/ruby/2.6.0/webrick/server.rb:307:in `block in start_thread'
127.0.0.1 - - [25/Jan/2021:09:24:25 EST] "GET /service-worker.js HTTP/1.1" 404 127410
- -> /service-worker.js
question from:https://stackoverflow.com/questions/65853361/ruby-on-rails-502-bad-gateway-with-no-nginx-installed-passenger

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...