0

I have created two custom error pages in nginx server 404.html and 500.html

I was able to load 404.html file without any issues. But in the place of 500.html, I am getting the default nginx error page (50x.html). Both the files are in the same folder. Please see my conf file content below

error_page   500 502 503 504 /500.html;
location = /500.html {
    root   /usr/share/nginx/html;
}

error_page   404 /404.html;
location = /404.html {
    root   /usr/share/nginx/html;
}

Thanks in advance :)

1
  • Did you find a solution to this? Commented Sep 20, 2021 at 10:19

2 Answers 2

1

This works for me.

error_page   500 502 503 504 /500.html;
location = /500.html {
    root   /usr/share/nginx/html;
    internal;
}
 
error_page   404 /404.html;
location = /404.html {
    root   /usr/share/nginx/html;
    internal;
}```

 
    
Sign up to request clarification or add additional context in comments.

Comments

0

for me the following code works.

error_page   404 500 502 503 504  /error.html;
location = /error.html {
    root   /usr/share/nginx/html;
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.