I'm using Nginx as a load balancer with app servers behind it. If the app servers return a response of 404 not found, I would like nginx
to then server out a 404 page that is local on that server. I would like to do this so my app servers don't get tied up serving a static HTML file and can instead just quickly return a response and let nginx
handle serving the static stuff. Does anyone know how I can accomplish this? Basically I need some kind of conditional check based on the HTTP response. Is this possible? Thanks!
相关问题
- How can I prevent my Shiny App from disconnecting
- Can't configure nginx as a proxy for tomcat wi
- How to set Nginx URI to fix empty URI in redirect
- Wordpress change all 404 to 410 error code
- R connect via proxy in Ubuntu
Simply set the
proxy_intercept_errors
option to on and create an nginx error page for it.To ensure that nginx will serve the static file from it’s document root you also have to specify the following:
I'm assuming here that nginx is configured to talk with your app servers as proxy, because that is the usual way and your question does not mention any of this.