Search code examples
rubynginxsinatrapassenger

Passenger + Nginx + Sinatra: friendly error page does not appear


Just installed Ruby by RVM and Passender: gem install passenger && rvmsudo passenger-install-nginx-module

Simple Sinatra app works fine:

app.rb:

require 'sinatra'
get '/' do
  "Hello World!"
end

config.ru:

require 'sinatra'
require './app.rb'
run Sinatra::Application

But when I add error in code, for example:

require 'sinatra'
get '/' do
  aaa # error here
  "Hello World!"
end

I exect to see purple friendly error page, but I see just: Internal Server Error if passenger_app_env production in nginx.conf, or standart An error occurred nginx error page if production passenger_app_env development. In both cases there is an error message in error.log


Solution

  • Asked here https://github.com/sinatra/sinatra/issues/963 and got the answer. It works now!

    The fix is already in master branch. Until a new release is made, you can point the gem to master:

    # Gemfile
    gem 'sinatra', github: 'sinatra/sinatra'