Fork me on GitHub 返回顶部

nginx 设置只能通过域名访问,禁止通过ip访问

实测效果:

  

 

方法:

  在ngnix的配置文件nginx.conf中,增加如下判断:  

    if ($host != '域名'){
      return 444;
    }

具体位置:

 

 

  

 

posted @ 2019-09-19 19:23  iris_huahua  阅读(1315)  评论(1编辑  收藏  举报