Passenger + Nginx shows a custom 500-page page

I am using Rails 3.2 with passenger + nginx. I want to show a nice custom 500 page page when the db server is down. I want to show something when the rails application 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 does not work at all. When this happens, it is displayed only:

Internal Server Error (500)

Any idea?

+4
source share
3 answers

Posted by Phusion Passenger here. Use passenger_switch_errors .

+2
source

from 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, the passenger error will not be displayed for failures at startup, and I believe that the link to the page with the message about the release of 500 nginx.

+1
source

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

+1
source

Source: https://habr.com/ru/post/1439348/


All Articles