【发布时间】:2017-01-04 01:33:57
【问题描述】:
我想使用 2 个服务器块。 第一个是:
server {
listen 443 ssl http2 fastopen=3 reuseport;
server_name a.example.xyz;
include server_safe.conf;
root /home/www/blog/;
}
第二个是:
server {
listen 443 ssl http2;
server_name b.example.xyz;
include server_safe.conf;
}
我想要的:
我希望 server_name 有效,也就是说,如果我使用 c.example.xyz 访问我的网站,a.example.xyz,b.example.xyz,c.example.xyz 是相同的 IP,服务器应该阻止 c.example.xyz 请求,因为它不在server_name 中。
但是,如果我输入https://c.example.xyz,Nginx 仍然会收到请求并回复为a.example.xyz
我知道 HTTP/2 的标头中没有主机,而是有一个 :authority。
我的问题是:我如何拒绝任何其他请求?我只想接受host(:authority) = a(b).example.xyz下的请求
【问题讨论】: