Nginx. If an empty URI. If the domain is empty. Location. Regex

I use the upstream module to balance my site. For some reason, I have to redirect some requests to the specified server. In short: I want to redirect domain.com to the specified server, domain.com/anything can be served by the upstream module. So if theres only a domain in the request and nothing more.

   location [here_something_i_dont_know]/ {
        proxy_pass           http://0.0.0.0:9000/;
        access_log      off;
    }

Thanks for the help!

+3
source share
1 answer
   location = / {
        proxy_pass http://0.0.0.0:9000/;
        access_log off;
   }
   location / {
        proxy_pass http: // another_upstream;
        access_log off;
   }
+4
source

Source: https://habr.com/ru/post/1780130/


All Articles