1. #在nginx.conf 中 将下面代码插入在http里server之前
  2. geo $trusted_user {
  3.  
  4. proxy 192.168.100.0/24;
  5. default 0;
  6. 127.0.0.1 1;
  7. 182.18.75.57 1;
  8. }
  9. allow 127.0.0.1;
  10. allow 182.18.75.57;
  11. deny all;
  12.  
  13. #然后再server中配置后台访问ip限制
  14. location /tp5admin/public/admin {
  15. if ( $trusted_user = 0 ) {
  16. return 404;
  17. }
  18. if (!-e $request_filename) {
  19. rewrite ^/tp5admin/public/(.*)$ /tp5admin/public/index.php?s=$1 last;
  20. break;
  21. }
  22.  
  23. }

0 条评论

发表回复

Avatar placeholder

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