I have configured my first nginx server, and I have to redirect subdomain1.domain.com, subdomain2.domain.com and a few more to domain.com
I searched a lot about rewriting in nginx but couldn't find anything that works. Thanks!
Nginx only knows about the (sub)domains that match a
You, therefore need to create a new server block that will match the subdomains you are interested in.
You can also use regex matching or a wildcard in the
Within that server block, add your rewrite (essentially amounting to, anything hitting these subdomains should be rewritten to my main domain).
Put it all together, and you get:
You can change