Skip to content
Advertisement

Wildcard subdomain and a specific subdomain configuration in same server Nginx

I had set up a wildcard subdomain server for my PHP app1 domain like *.domain.com in Nginx default configuration. My app1 was serving if someone type x.domain.com or y.domain.com everything was fine.

When I set up another virtual host for a specific subdomain in this domain specific.domain.com for app2. After that, when I type x.domain.com it’s showing me app2 but I wanted to show app2 only for specific.domain.com and app1 for *.domain.com

JavaScript

Advertisement

Answer

Just solved this problem to add more 1 server block and take specific.domain.com first then *.domain.com. And I leave the default server block blank

Here is my code example

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement