我有非常简单的配置:
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的任何请求。
DNS配置会出现问题吗?我有以下设置:
www A 164.138.29.xxx for test2.ru;
和
test A 164.138.29.xxx for test.mydomain.ru;
发布于 2017-06-29 10:39:12
*.test2.ru只匹配“某样东西.test2.ru”。
您需要将*.test2.ru和test2.ru添加到server_name配置中。
编辑:显然,您还可以执行以下操作来匹配两个条目:
表单“.example.org”中的特殊通配符名称可以用于匹配确切的名称“example.org”和通配符名“*.example.org”。
此外,为了使test2.ru工作,您需要确保test2.ru解析为IP地址。您显示的DNS记录仅涵盖www.test2.ru和test.test2.ru。
https://serverfault.com/questions/858536
复制相似问题