ServerName weirdness in Nginx


#1

does anyone have an idea on that? ee (latest version) with a site running on domain.com great for quite a while now. I now wanted to make sure I also point subdomains to this host. I changed ServerName to:

ServerName domain.com *.domain.com

using ee site edit domain.com

Nginx got reloaded afterwards. domain.com still works. sub.domain.com shows nginx default page. I checked the DNS Settings and pinged sub.domain.com - points to the same IP than domain.com, I reloaded nginx once more, checked the config file, reloaded it once more. still the same.

I’m a bit buffled now. ideas?

(It’s a wordpress php7 setup but i guess that doesn’t matter and I also checked that sub.domain.com is on no other config files on the server)


#2

In Nginx, wildcard character is not *, but _ instead.


#3

thanks, interestingly it passed nginx -t text and after changing it now I still get the nginx default page on sub.domain.com- there seems to be something else causing this.

EDIT: these calls to the subdomain definitely don’t get handled by the vhost but the default host instead. They also appear in the default logfiles.


#4

Try renaming the vhost in /etc/sites-enabled from default.conf to zzzzzz-default.conf or something like this. I had such kind of issues before, and this workaround did the trick for me.


#5

after renaming the default conf the subdomain hits another host that is now first in the alphabetical order of config files.

There’s really some weird stuff going on.


#6

pushing this up once more as I still didn’t get this fixed.

Looks like whatever I do to get sub.domain.com to be used by my domain.com vhost it only drops to the first vhost in the nginx config directory. it was on the default before, i moved away the default so it now hits the first vhost in place.

nginx -t reports no errors.

Any idea?

domain.com is running LE (SSL) if that


#7