In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
The update of this article dragged on for half a month, which really touched China.
Nginx caches DNS by default. As we all know, if you do reverse proxy, it is actually the target ip of access, so once the target ip is cached, it will be very troublesome.
The four ways of writing anise are well known, never thought that Nginx dynamic DNS reverse proxy also has N kinds of play, which mainly depends on the version of Nginx you use, of course, the operation tells me that it is best not to use dynamic DNS, but based on business needs, we have no way.
The first way to write the word: Nginx
In Nginx, you can save the country by setting variables. Of course, there are disadvantages. There is no way to perform Load Balancer through variable methods. It is very troublesome. Of course, if you only have a single machine (almost non-existent in actual business scenarios), you can still try it:
server { ... resolver 127.0.0.1; set $backend "http://dynamic.example.com:80"; proxy_pass $backend; ...}
The second is Nginx Plus.
Of course, Nginx is not very easy to use, the enhanced version of Plus provides a better way to write, it supports writing in the server:
server { ... resolver 127.0.0.1 valid=30s; proxy_pass http://upstream-sites; ...}
The third word: engine
Tengine is Taobao's magic to Nginx, in fact, I am very annoying, because at first I do not know we use Tengine, resulting in configuration of no eggs, but Tengine for dynamic domain name resolution support is very good, the official documentation is also very clear.
upstream backend { dynamic_resolve fallback=stale fail_timeout=30s; server a.com; server b.com;}server { ... location / { proxy_pass http://backend; }}
other
Of course, you can also use Lua script to implement, or someone else's module, but considering the fear of tampering, I still don't mess around, so I didn't take this solution.
reference
ngx_http_upstream_dynamic_module - Tengine
Using DNS for Service Discovery with NGINX and NGINX Plus
The above is all the content of this article, I hope to help everyone's study, but also hope that everyone a lot of support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.