前端之家收集整理的这篇文章主要介绍了
如何拒绝Nginx中的子域请求,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
如果我的配置看起来像@H_403_2@
@H_403_2@
server {
listen 80;
server_name example.com;
}
如何拒绝对subdomain.example.com的请求?
最佳答案
server {
listen 80;
server_name subdomain.example.com;
deny all;
}
或者,如果您想要删除未在配置中另一个服务器块中明确定义的域的所有流量:@H_403_2@
@H_403_2@
server {
listen 80 default_server;
server_name _;
deny all;
}