我有非常简单的configuration:
server { listen 80; server_name test.mydomain.ru; location / { proxy_pass http://127.0.0.1:8081; } } server { listen 80; server_name *.test2.ru; index index.html; location / { root html; } }
当我访问test2.ru test.mydomain.ru打开。 为什么? *.test2.ru应该处理任何对test2.ru请求。
这可能是DNSconfiguration的问题吗? 我有以下设置:
对于test2.ru , www A 164.138.29.xxx为test2.ru ;
和
为test.mydomain.ru; test A 164.138.29.xxx test.mydomain.ru;
*.test2.ru只会匹配“.test2.ru”。
您需要将*.test2.ru和test2.ru添加到server_nameconfiguration中。
编辑:显然你也可以做到以下两个匹配与单个条目:
可以使用“.example.org”forms的特殊通配符名称来匹配确切名称“example.org”和通配符名称“*。example.org”。
此外,只是test2.ru工作,你需要确保test2.ruparsing为IP地址。 您显示的DNSlogging仅涵盖www.test2.ru和test.test2.ru 。