Reputation: 775
How can you use regular expression to do this:
preprod.*.company.com > root to /home/preprod_folder
*.company.com > root to /home/prod_folder
I know that to match *.company.com I will create:
server_name *.company.com
But what about for a regular expression that match before *.company.com, this rule preprod.allsubdomains.company.com
preprod.*.company.com
is not working, and that's normal.
Could you help me please?
Thanks.
Upvotes: 2
Views: 1717
Reputation: 13411
You say "redirect", but it looks like your intent is to set the root
directory instead. Perhaps this is what you are looking for:
server_name ~^preprod\.(?<subdomain>\w+).company.com;
root /home/prepod_folder;
Upvotes: 1