I want to show one custom maintenance page
for all errors
. What code should I put to my nginx setting below? and the file of my nginx setting is located at /etc/nginx/conf.d/default.conf
.
server {
listen 80;
listen [::]:80;
server_name myip;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://myapp:8000;
}
location /static/ {
alias /myapp/static/;
}
location /media/ {
alias /myapp/media/;
}
}
And this is my maintenance.html
file below.
<!DOCTYPE html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
<article>
<h1>We’ll be back soon!</h1>
<div>
<p>Sorry for the inconvenience. We’re performing some maintenance at the moment.</p>
</div>
</article>
My maintenance.html
looks like this on browsers.