Chamnap
Chamnap

Reputation: 4766

Passenger+Nginx show custom 500 page

I'm using Rails 3.2 with passenger+nginx. I want to display nice custom 500 page when the db server is down. I want to show something when my rails app cannot be started. Here is my nginx:

server {
  listen 80;
  server_name localhost;
  root /var/www/store/public;
  error_page   500  /500.html;

  # root
  location / {
    passenger_enabled on;
    rails_env production;
    passenger_use_global_queue on;
  }

}

The above configuration doesn't work at all. When it happens, it shows only:

Internal Server Error (500)

Any idea?

Upvotes: 5

Views: 1629

Answers (3)

Hongli
Hongli

Reputation: 18944

Phusion Passenger author here. Use passenger_intercept_errors off.

Upvotes: 3

Moriko Handford
Moriko Handford

Reputation: 383

mariow's link led me to the answer. The error files are in the templates folder. I use rvm, so my templates folder is at /home/forest.handford/.rvm/gems/ruby-2.0.0-p481/gems/passenger-4.0.50/resources/templates/ . Use find / -name templates | grep passenger to find yours. I'm changing undisclosed_error.html.template for my site, as it is the error that occurs when people type an invalid URL .

Upvotes: 1

danmanstx
danmanstx

Reputation: 1712

from the passenger documentation http://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerFriendlyErrorPages

passenger_friendly_error_pages off

Which can be placed inside the http block, server block or location block, will not show the passenger error for startup failures and I believe link to the nginx supplied 500 error page.

Upvotes: 1

Related Questions