Back

nginx - 使用定制的500页面

发布时间: 2019-04-23 10:38:00

参考:https://stackoverflow.com/questions/10895071/how-to-create-custom-error-502-nginx-in-core-of-nginx-not-using-redirect-to-err

1. 在 /etc/nginx下,添加 500.html 

<html>
  <body style='background-image: url(https://files.wondercv.com/website_error.png);
    background-repeat:no-repeat;
    background-position: center center;
  '>
  </body>
</html>


2. 在对应的站点中,最下面的一行,加入:

server{
  # .. 其他代码
  error_page 500 502 503 /500.html;
  location = /500.html {
    root  /etc/nginx;
  }
}

Back