I am trying to use Nginx to redirect to a custom maintenance page, with it's own CSS/JS, when a maintenance file exists on the system. However, it just shows me the standard Nginx 503 redirect page?
location / {
if (-f /var/www/html/maintenance_mode_on){
return 503;
}
root /var/www/html/my_normal_site/;
index index.html index.htm;
}
error_page 503 @maintenance;
location @maintenance {
root /var/www/html/maintenance/;
index maintenance.html;
}
It may be better to use a slightly different approach, for example:
The html document will be returned with a 503 error code as previously.
But any resource files will be available using a relative URL (e.g.
css/example.css)Or using an absolute URL (e.g.
/maintenance/css/example.css)