Nginx how to realize grayscale release according to IP
This article mainly explains "nginx how to achieve grayscale release according to IP", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "nginx according to IP how to achieve grayscale release" bar!
Nginx load balancer determines client IP address
If not, reverse proxy to the production environment.
Upstream prod {
Server 192.168.1.10
Server 192.168.1.11
}
Upstream pre-prod {
Server 192.168.1.100
}
Server {
Listen 80
Access_log / var/log/nginx/access.log main
Set $web_backend prod
If ($remote_addr ~ "123.123.123.123") {
Set $web_backend pre-prod
}
Location / {
Proxy_pass http://$web_backend;
Include proxy.conf
}
}
Note: the set command depends on the rewrite module.
At this point, I believe that everyone on the "nginx according to IP how to achieve gray release" have a deeper understanding, might as well to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!