After some researching and experimentation, I discovered an simple and elegant solution for posting a maintenance page for nginx and Passenger without using ifs and rewrites in the nginx.conf file.
Use something like this in nginx.conf, in the server block:
try_files
$uri /maintenance.html @passenger; passenger_enabled on;
root /data/
location @passenger {
# lolwut? we need this for try_files
passenger_enabled on;
root /data/
}
Simply symlink maintenance.html when you need to go offline, and remove it to go back to normal operation.
No comments:
Post a Comment