Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4069256
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:28:42+00:00 2026-05-20T16:28:42+00:00

Im using Rails, Passenger (both are 3.0.5) and Nginx on my production server. As

  • 0

Im using Rails, Passenger (both are 3.0.5) and Nginx on my production server. As I heard, Rails should show public/404.html or public/500.html instead of development errors like ActiveRecord::RecordNotFound or Unknown action but that doesn’t happen. I’ve tried to delete config.ru file and set rack_env or rails_env in nginx.conf but nothing helped.

Here is my nginx.conf:

worker_processes  1;

events {
    worker_connections  1024;
}

http {
    passenger_root /home/makk/.rvm/gems/ruby-1.9.2-p0/gems/passenger-3.0.5;
    passenger_ruby /home/makk/.rvm/bin/passenger_ruby;
    #passenger_ruby /home/makk/.rvm/wrappers/ruby-1.9.2-p0/ruby;

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

    sendfile        on;
    keepalive_timeout  65;

    server {
        listen       80;
        server_name  localhost;

        location / {
            root   /home/makk/projects/1server/deploy/current/public;
            index  index.html index.htm;
            passenger_enabled on;
            rack_env production;

            recursive_error_pages on;

            if (-f /home/makk/projects/1server/maintenance.html) {
              return 503;
            }

            error_page 404 /404.html;
            error_page 500 502 504 /500.html;
            error_page 503 @503;
        }

        location @503 {
            error_page 405 = /maintenance.html;

            # Serve static assets if found.
              if (-f $request_filename) {
              break;
            }
            rewrite ^(.*)$ /maintenance.html break;
        }

        location ~ ^(\/phpmyadmin\/)(.*)$ {
        fastcgi_pass    127.0.0.1:9000;
        fastcgi_index   index.php;
        fastcgi_split_path_info         ^(\/phpmyadmin\/)(.*)$;
        fastcgi_param   SCRIPT_FILENAME /usr/share/phpmyadmin/$fastcgi_path_info;
        include         fastcgi_params;
        }
    }
}

It seems that this question duplicates this one but there are no working suggestions.

UPD: I have both development and production apps on same PC. In production Rails ignores config.consider_all_requests_local = false (in /config/environments/production.rb) due to local_request? method. So one of possible solutions is listed below (taken from here):

# config/initializers/local_request_override.rb
module CustomRescue
  def local_request?
    return false if Rails.env.production? || Rails.env.staging?
    super
  end
end

ActionController::Base.class_eval do
  include CustomRescue
end

Or for Rails 3:

class ActionDispatch::Request
 def local?
   false
 end
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T16:28:42+00:00Added an answer on May 20, 2026 at 4:28 pm

    Move your root declaration up to the “server” block so the server can use the Rails app defined error handling pages when it receives a 5XX, 4XX error.

    Or add error_page directives to the location block where passenger is being used so the error handlers can resolve the public/5xx.html in the Rails app public directory when needed.

    If your app is not serving up the page and nginx has no visibility to the static page then it can’t serve the page you want.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Rails is giving a 500 error (in a production environment using Passenger). The production
We are trying to deploy our Rails app using Passenger and Nginx on a
We have a website using Rails 2.3.x, bundler, nginx, passenger and git, and would
I am using rails(2.3.10)/passenger(2.2.15)/nginx(0.7.67) , when i run my application, it give me 502
One of my rails apps (using passenger and apache) is changing server hosts. I've
So I am using Capistrano to deploy a rails application to my production server
Using rails nginx with passenger. I put the following in the nginx.conf file for
I just deployed a rails app using passenger. Now i am getting a 404
I have nginx installed (was using it for Ruby on rails with passenger). What
Using Whenever 0.7.3, Rails 3.2.2, Ruby 1.9.3, Passenger 3.0.11 on a CentOS 5.6 server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.