Home > other >  Nginx domain if contains name
Nginx domain if contains name

Time:11-30

I want to know if possible to set server names with 5-6 domain in 1 directive.

For example:

 server_name
*.google.com
*.google1.com
*.google2.com
*.google3.com
*.google4.com
*.google5.com

My question is like this Can i make

 server_name
*.google*.com #This will include google1.com google2.com google3.com 

is it possible?

CodePudding user response:

Here solution

 server_name
"~^google(\d{1,3} )\.com"
*.facebook.com
*.twitter.com

~^google will start with google and (\d{1,3} ) will include numbers.

  • Related