All errors can be modified.
First create a file and give it a name, for example: 500.html
.
I'll put this in the /usr/share/nginx/error/
directory, this will prevent access to meusite.com/500.html
from displaying the error, by default the site directory is usr/share/nginx/html/
. ;)
Change the settings to:
error_page 502 /500.html;
location = /500.html {
root /usr/share/nginx/error;
}
Normally, the directory of the file you should change is /etc/nginx/conf.d/default.conf
, in CentOS.
For better demonstration should look something like this:
server {
listen 80;
server_name meusite.com.br;
location / {
root /usr/share/nginx/html;
index index.php index.html index.htm;
}
error_page 502 /500.html;
location = /500.html {
root /usr/share/nginx/error;
}
//...
}