Friendly error page not showing up

545 views
Skip to first unread message

Gerard Martin

unread,
Jul 13, 2017, 12:43:51 PM7/13/17
to Phusion Passenger Discussions
Hello everyone,

We've been having a problem where the Passenger friendly error page is not showing up despite `passenger_friendly_error_pages on` being set in the nginx config.

We're running Rails 4.2.8, Ruby 2.4.1, nginx 1.10.3 compiled with Passenger 5.1.5 from the APT repository.

nginx.conf

user user_name;

worker_processes
auto;
pid
/var/run/nginx.pid;

events
{
    worker_connections  
1024;
}

http
{
    sendfile on
;
    tcp_nopush on
;
    tcp_nodelay on
;
    keepalive_timeout
65;
    types_hash_max_size
2048;
    server_names_hash_bucket_size
64;

    include
/etc/nginx/mime.types;
    default_type application
/octet-stream;

    access_log
/var/log/nginx/access.log;
    error_log
/var/log/nginx/error.log;

    gzip on
;
    gzip_disable
"msie6";

    passenger_root  
/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
    passenger_ruby  
/etc/nginx/ruby_wrapper;
    passenger_friendly_error_pages on
;

    include
/etc/nginx/sites-enabled/*;
}


The ruby_wrapper program just exports some environment variables and sources RVM's Ruby wrapper, and I've tried using the RVM wrapper directly and encountered the same problem, so that part has been ruled out.

The single sites-enabled file has

passenger_max_pool_size  6;
passenger_start_timeout  
180;


set, and then defines a port 80 server that redirects to https, and a 443 server with ssl turned on and a `passenger_enabled on;` directive.

We haven't set a passenger_app_env anywhere, relying on it's default to `production`.

Thinking of things that might be causing the error, the root of the rails repository has a file called public/500.html, and this is indeed the file that is being loaded when Passenger hits a 500 error in the application. Removing this file lead to a plain 500 error with no content being returned at all.

Any help would be appreciated!

Thanks,
Gerard

Daniel Knoppel

unread,
Jul 14, 2017, 8:01:47 AM7/14/17
to Phusion Passenger Discussions
Passenger can display friendly error pages whenever an application fails to start.

* Is the application failing to start or is there another error occurring?
* Is Passenger running? (passenger-status)
* Is the request you're using to test actually routed by Nginx to Passenger?

- Daniel

Gerard Martin

unread,
Jul 14, 2017, 10:32:13 AM7/14/17
to Phusion Passenger Discussions
Hi,

Passenger can display friendly error pages whenever an application fails to start.

But it can also show Rails stack traces and errors as well, right?

 * Is the application failing to start or is there another error occurring? 

No, no other errors, nginx configtest is good, application functions as normal.

* Is Passenger running? (passenger-status)

Yeah, passenger-status comes back clean

 * Is the request you're using to test actually routed by Nginx to Passenger?

Yes, I can see requests come through on passenger-status.

- Gerard 

Daniel Knoppel

unread,
Jul 17, 2017, 5:58:17 AM7/17/17
to Phusion Passenger Discussions
On Friday, July 14, 2017 at 4:32:13 PM UTC+2, Gerard Martin wrote:
Hi,

Passenger can display friendly error pages whenever an application fails to start.

But it can also show Rails stack traces and errors as well, right?

If they occur during spawning, then Passenger shows the friendly error page. 

Otherwise Passenger just passes on whatever the app sends out. For rails to show traces I'd guess you need the RAILS_ENV to not be "production" (rather, "development"). You can set that via Passenger's passenger_app_env.

- Daniel
Reply all
Reply to author
Forward
0 new messages