Does anyone know the rewrite rule for nginx to configure a domain name to jump randomly?

does anyone know the rewrite rule for nginx to configure random redirects to a domain name?
is a parent domain name that is randomly distributed and redirected to one of several subdomains.

Mar.28,2022

Oh, are you talking about load balancing? Here is a piece of Nginx load balance that you can take a closer look at. It is roughly written as follows:

http {
    upstream myapp1 {
        server srv1.example.com;
        server srv2.example.com;
        server srv3.example.com;
    }

    server {
        listen 80;

        location / {
            proxy_pass http://myapp1;
        }
    }
}

I hope I can help you.

Menu