Sunday, May 17th, 2009...12:13 pm

Getting Capistrano’s web:disable To Work With Nginx

Jump to Comments

Recently I deployed a new Ruby on Rails application using nginx+passenger instead of the usual apache+passenger configuration.

As a result, I couldn’t use the traditional Apache rewrite rules to display the maintenance.html page if it existed.

Here are the necessary corresponding rewrite rules for nginx to achieve the same effect.

if (-f $document_root/system/maintenance.html) {
    rewrite ^(.*)$ /system/maintenance.html break;
}

Place this inside your server {} block and you should be able to run cap deploy:web:disable and cap deploy:web:enable with no problems.

1 Comment

© 2018 Craig P Jolicoeur.