Search code examples
ruby-on-railsapache2passenger

Getting error using Rails Passenger


I have uploaded a rails application to my ubuntu server I am using apache2 and passenger

I have tested all settings in my local using rails s -e production it is working fine.

I am running my rails app using rails s -e production in server I can access my application with my domain abc.com:3000 I can see it running I don't know what else I need to do. My production log is like this:

   F, [2018-05-28T10:56:13.167965 #17419] FATAL -- : [8498ddeb-113e-4d0d-8d78-a33acf089435]
  F, [2018-05-28T10:56:13.168034 #17419] FATAL -- : [8498ddeb-113e-4d0d-8d78-a33acf089435] ActionController::RoutingError (No route matches [GET] "/favicon.ico"):
  F, [2018-05-28T10:56:13.168063 #17419] FATAL -- : [8498ddeb-113e-4d0d-8d78-a33acf089435]
  F, [2018-05-28T10:56:13.168091 #17419] FATAL -- : [8498ddeb-113e-4d0d-8d78-a33acf089435] actionpack (5.2.0) lib/action_dispatch/middleware/debug_exceptions.rb:65:in `call'
  [8498ddeb-113e-4d0d-8d78-a33acf089435] actionpack (5.2.0) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
  [8498ddeb-113e-4d0d-8d78-a33acf089435] railties (5.2.0) lib/rails/rack/logger.rb:38:in `call_app'
  [8498ddeb-113e-4d0d-8d78-a33acf089435] railties (5.2.0) lib/rails/rack/logger.rb:26:in `block in call'
  [8498ddeb-113e-4d0d-8d78-a33acf089435] activesupport (5.2.0) lib/active_support/tagged_logging.rb:71:in `block in tagged'
  [8498ddeb-113e-4d0d-8d78-a33acf089435] activesupport (5.2.0) lib/active_support/tagged_logging.rb:28:in `tagged'
  [8498ddeb-113e-4d0d-8d78-a33acf089435] activesupport (5.2.0) lib/active_support/tagged_logging.rb:71:in `tagged'
  [8498ddeb-113e-4d0d-8d78-a33acf089435] railties (5.2.0) lib/rails/rack/logger.rb:26:in `call'
  [8498ddeb-113e-4d0d-8d78-a33acf089435] actionpack (5.2.0) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
  [8498ddeb-113e-4d0d-8d78-a33acf089435] actionpack (5.2.0) lib/action_dispatch/middleware/request_id.rb:27:in `call'
  [8498ddeb-113e-4d0d-8d78-a33acf089435] rack (2.0.5) lib/rack/method_override.rb:22:in `call'
  [8498ddeb-113e-4d0d-8d78-a33acf089435] rack (2.0.5) lib/rack/runtime.rb:22:in `call'
  [8498ddeb-113e-4d0d-8d78-a33acf089435] activesupport (5.2.0) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
  [8498ddeb-113e-4d0d-8d78-a33acf089435] actionpack (5.2.0) lib/action_dispatch/middleware/executor.rb:14:in `call'
  [8498ddeb-113e-4d0d-8d78-a33acf089435] rack (2.0.5) lib/rack/sendfile.rb:111:in `call'
  [8498ddeb-113e-4d0d-8d78-a33acf089435] rack-cors (1.0.2) lib/rack/cors.rb:97:in `call'
  [8498ddeb-113e-4d0d-8d78-a33acf089435] railties (5.2.0) lib/rails/engine.rb:524:in `call'
  [8498ddeb-113e-4d0d-8d78-a33acf089435] puma (3.11.4) lib/puma/configuration.rb:225:in `call'
  [8498ddeb-113e-4d0d-8d78-a33acf089435] puma (3.11.4) lib/puma/server.rb:632:in `handle_request'
  [8498ddeb-113e-4d0d-8d78-a33acf089435] puma (3.11.4) lib/puma/server.rb:446:in `process_client'
  [8498ddeb-113e-4d0d-8d78-a33acf089435] puma (3.11.4) lib/puma/server.rb:306:in `block in run'
  [8498ddeb-113e-4d0d-8d78-a33acf089435] puma (3.11.4) lib/puma/thread_pool.rb:120:in `block in spawn_thread'

So my question is how to fix this. After searching some logs I am getting this error:

 /bin/sh: 1: exec: /root/.rbenv/versions/2.5.1/bin/ruby: Permission denied

This error I am getting inside passenger log


Solution

  • I think it has something to do with permission of the folder passenger is unable to execute code.

    Try something like this change permission of your application folder like:

    sudo chmod -R 777 /path-to-folder/
    

    And restart apache server using :

    sudo service apache2 restart
    

    And you can also check vhost file where you have added passenger ruby.

    If chmod 777 works then you have your problem solved you can change your application folder permission like this:

    sudo chmod -R 755 /path-to-folder/