User Tools

Site Tools


wiki:avoid_upstream_not_found_nginx_using_only_one_server

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
wiki:avoid_upstream_not_found_nginx_using_only_one_server [2023/03/30 14:52] – created antisawiki:avoid_upstream_not_found_nginx_using_only_one_server [2023/04/18 12:34] (current) – add docker tag, formatting antisa
Line 1: Line 1:
-{{tag>nginx}}+{{tag>nginx docker}}
  
 ====== Avoid upstream not found in nginx when using only one upstream server ====== ====== Avoid upstream not found in nginx when using only one upstream server ======
Line 7: Line 7:
 server { server {
   listen 80;   listen 80;
 +  resolver 127.0.0.11 valid=30s; # docker's resolver
   set $target "http://target-host:3005";  # variable definition   set $target "http://target-host:3005";  # variable definition
-  location / { proxy_pass $target; }+  location / {  
 +    proxy_pass $target;  
 +  }
 } }
 </code> </code>
  
 This will not error out if the target-host is not available (for example in some Docker setup).  This will not error out if the target-host is not available (for example in some Docker setup). 
 +
 +<WRAP center round help 60%>
 +resolver is probably needed even when the target host is not a docker container
 +</WRAP>
  
 The following example however will give you an error if the target-host can not be resolved: The following example however will give you an error if the target-host can not be resolved:
wiki/avoid_upstream_not_found_nginx_using_only_one_server.1680180771.txt.gz · Last modified: 2023/03/30 14:52 by antisa

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki