Score:0

How to define www.*.abc.example.com wildcard domain in nginx server block?

in flag

I want to define my own domain something like this - www..abc.example.com in nginx server blocks . i have tried to do like this - www(.).abc.example.com * & it throws error like - nginx: [emerg] invalid server name or wildcard "www(.*).abc.example.com" on 0.0.0.0:443

Ivan Shatsky avatar
gr flag
`server_name ~ ^www\..*\.abc\.example\.com$;`
sambit avatar
in flag
@IvanShatsky i am getting error - nginx: [emerg] empty regex in server name "~" in /etc/nginx/sites-enabled/ now after adding the above content .
Ivan Shatsky avatar
gr flag
Yep... there should be no space between the `~` and the regex pattern: `server_name ~^www\..*\.abc\.example\.com$;`
sambit avatar
in flag
thanks it worked , however now i am getting another issue -
sambit avatar
in flag
thanks @IvanShatsky it worked , however i am getting the following ssl error - This server could not prove that it is www.abc.example.com ; its security certificate is from *.abc.example.com. This may be caused by a misconfiguration or an attacker intercepting your connection. Please let me know how to fix the issue . and i am using amazon acm manager to get a certificate for my website . which i had requested only for *.abc.example.com earlier , But how to request a new certificate for the www domain as well ?
Ivan Shatsky avatar
gr flag
Certificate issued for `*.abc.example.com` should work for `www.abc.example.com`. I know nothing about amazon acm manager (as well as about any other amazon services). The only thing I ever used to get a wildcard certificate is the [ACME Shell script](https://github.com/acmesh-official/acme.sh) in the [DNS manual mode](https://github.com/acmesh-official/acme.sh/wiki/DNS-manual-mode).
sambit avatar
in flag
thanks for your recommendations , i will check the scme shell script .
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.