#在nginx.conf 中 将下面代码插入在http里server之前
geo  $trusted_user   {

    proxy 192.168.100.0/24;
    default 0;
    127.0.0.1 1;
    182.18.75.57 1;
}
allow 127.0.0.1;
allow 182.18.75.57;
deny all;

#然后再server中配置后台访问ip限制
  location /tp5admin/public/admin {
      if ( $trusted_user = 0 ) {
        return 404;
      }
      if (!-e $request_filename) {
        rewrite  ^/tp5admin/public/(.*)$  /tp5admin/public/index.php?s=$1  last;
        break;
     }

  }

0 条评论

发表回复

Avatar placeholder

您的电子邮箱地址不会被公开。 必填项已用*标注