I have nginx 0.8.53 configured with some virtual hosts which work as desired. However, due to nginx's "best match" on virtual hosts, I need to add a default host to catch all requests that aren't for a specific virtual host. I would like the default host to return a custom 404 page that I created instead of the default nginx 404 page.
I assumed I needed something like:
# The default server:
server {
listen 80 default_server;
server_name everythingelse;
# Everything is a 404
location / {
return 404;
}
error_page 404 /opt/local/html/404.html;
}
But this still returns the default nginx 404 page. It seems the return 404
ignores the error_page
config.