This config works correctly as expected:
server {
listen 80;
server_name www.domain1.com domain1.com;
access_log /srv/www/domain1.com/logs/access.log;
location / {
root /srv/www/domain1.com/public_html;
index index.html index.htm;
}
}
server {
listen 80;
server_name domain2.com www.domain2.com;
access_log /srv/www/domain2.com/logs/access.log;
location / {
root /srv/www/domain2.com/public_html;
index index.html index.htm;
}
}
This config displays the content from domain1 when accessing http://domain2.com:
server {
listen 80;
server_name *.domain1.com;
access_log /srv/www/domain1.com/logs/access.log;
location / {
root /srv/www/domain1.com/public_html;
index index.html index.htm;
}
}
server {
listen 80;
server_name *.domain2.com;
access_log /srv/www/domain2.com/logs/access.log;
location / {
root /srv/www/domain2.com/public_html;
index index.html index.htm;
}
}
I feel like I'm following the docs correctly in both cases.
What would cause the unexpected behavior using wildcards in example two?
*.domain2.com
doesn't matchdomain2.com
. do:instead