Nginx URL Fallback setup with internal redirection in reverse-proxy settings

Francis Daly francis at
Fri Jun 19 19:53:15 UTC 2015

On Fri, Jun 19, 2015 at 10:59:00PM +0530, Ashish k wrote:

Hi there,

> Set up Nginx config so that any URL address which is not found, goes
> to a fallback path with internal redirection (NO change or redirection
> in browser URL).

> Please point me to NGINX resources and a steps that will be required
> so that I can grasp NGINX quickly to do the above task.

It sounds like you want your own handler for 404 errors. So

  error_page 404 @404;


  error_page 404 = @404; for details. and the difference between
the two lines.

Then in "location @404 {}", do what you want - proxy_pass or fastcgi_pass
to something external with appropriate other settings, most likely.

Good luck with it,

Francis Daly        francis at

More information about the nginx mailing list