0

I am new to nGinx and I need some help redirecting all errors to a default page.

EG: I want all 500 Internal Server errors and 404 Not Found errors to be redirected to http://www.mydomain.com/error.php

I currrently added this into my nginx.conf file:

http {
    server {
        error_page 404 http://www.mywebsite.com/error.php;
        error_page 500 http://www.mywebsite.com/error.php;

        }
................
................
}

But nothing happens after I restart nGinx.

When I visit a page that doesn't exist, I still get the default error page from nGinx.

2 Answers 2

1

Are you using FastCGI or Proxy?

To get working with FastCGI or Proxy Maybe, you must switch proxy_intercept_errors or fastcgi_intercept_errors to on.

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

Comments

0

you may have another "server" section in another conf file which overrides this setting. Place your error_page directives in the conf file that handles your site.

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.