Can I make nginx proxy retry after a short delay if a backend fails to respond?
-
I run mod_wsgi on Apache behind nginx. When I deploy new code I restart the Apache server, which means for about a second any hits to nginx will get an error message. Is it possible to configure nginx to hold the user's connection open for a couple of seconds and then try the backend again, only returning an error if the second attempt fails?
-
Answer:
upstream myserver { - server 0.0.0.0:8888; + server 0.0.0.0:8888 fail_timeout=1s; server 0.0.0.0:8666 backup; }
Nathan Schmidt at Quora Visit the source
Other answers
You might want to look into the these two nginx config options * proxy_connect_timeout * proxy_next_upstream If you set your proxy_connect_timeout suitably low (<2s?) and with proxy_next_upstream set to "error" then in theory the next upstream server should be hit after the connect timeout is reached. But as a whole have a look at the nginx proxy module configuration - there might be other goodies: http://wiki.nginx.org/NginxHttpProxyModule
Cody Caughlan
Related Q & A:
- How can I make a myspace comment into a picture caption?Best solution by Yahoo! Answers
- Can I make a PayPal account with a prepaid visa gift card?Best solution by Yahoo! Answers
- How can I make a phone call to a cruise ship?Best solution by traveltips.usatoday.com
- How can I make a good clay for a school project?Best solution by answers.yahoo.com
- Can I make my fan page into a group page on facebook?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.