如何拒绝Nginx中的子域请求

如果我的配置看起来像server { listen 80; server_name example.com; } 如何拒绝对subdomain.example.com的请求?最佳答案server { listen 80; server_name subdomain.example.com; deny all; } 或者,如果您

如果我的配置看起来像

server {
  listen 80;
  server_name example.com;
}

如何拒绝对subdomain.example.com的请求?
最佳答案

server {
    listen 80;
    server_name subdomain.example.com;
    deny all;
}

或者,如果您想要删除未在配置中另一个服务器块中明确定义的域的所有流量:

server {
    listen 80 default_server;
    server_name _;
    deny all;
}

作者: dawei

【声明】:西安站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。

为您推荐

联系我们

联系我们

0577-28828765

在线咨询: QQ交谈

邮箱: xwei067@foxmail.com

工作时间:周一至周五,9:00-17:30,节假日休息

返回顶部