vps交流

宝塔不装web如何禁止IP访问


装了 nginx之后卸载了  

现在直接访问ip还是会显示

恭喜, 站点创建成功!

情节大佬默认的这个页面配置文件在哪
或者还有其他办法禁止ip访问吗

就不能关闭端口吗宝塔不装web如何禁止IP访问
/www/server/panel/vhost/cert/default/fullchain.pem

  1. —–BEGIN CERTIFICATE—–
  2. MIIDITCCAsagAwIBAgIUTcEWLzynkLCFCoAC1iDH2vG3EkYwCgYIKoZIzj0EAwIw
  3. gY8xCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T
  4. YW4gRnJhbmNpc2NvMRkwFwYDVQQKExBDbG91ZEZsYXJlLCBJbmMuMTgwNgYDVQQL
  5. Ey9DbG91ZEZsYXJlIE9yaWdpbiBTU0wgRUNDIENlcnRpZmljYXRlIEF1dGhvcml0
  6. eTAeFw0xOTAxMTMxNDMxMDBaFw0zNDAxMDkxNDMxMDBaMGIxGTAXBgNVBAoTEENs
  7. b3VkRmxhcmUsIEluYy4xHTAbBgNVBAsTFENsb3VkRmxhcmUgT3JpZ2luIENBMSYw
  8. JAYDVQQDEx1DbG91ZEZsYXJlIE9yaWdpbiBDZXJ0aWZpY2F0ZTBZMBMGByqGSM49
  9. AgEGCCqGSM49AwEHA0IABAg/hZ9lDHj/f+0jDRAN23TkNEqIi46mCGnwZVD3glxL
  10. l+a1mpfXLHSEFTipnSyQgmvkPYzQGaEIFD0q6W/ZgMujggEqMIIBJjAOBgNVHQ8B
  11. Af8EBAMCBaAwHQYDVR0lBBYwFAYIKwYBBQUHAwIGCCsGAQUFBwMBMAwGA1UdEwEB
  12. /wQCMAAwHQYDVR0OBBYEFCEZF6Eyem01XPbgwr6DXLZV1qsQMB8GA1UdIwQYMBaA
  13. FIUwXTsqcNTt1ZJnB/3rObQaDjinMEQGCCsGAQUFBwEBBDgwNjA0BggrBgEFBQcw
  14. AYYoaHR0cDovL29jc3AuY2xvdWRmbGFyZS5jb20vb3JpZ2luX2VjY19jYTAjBgNV
  15. HREEHDAaggwqLmRuc3BvZC5jb22CCmRuc3BvZC5jb20wPAYDVR0fBDUwMzAxoC+g
  16. LYYraHR0cDovL2NybC5jbG91ZGZsYXJlLmNvbS9vcmlnaW5fZWNjX2NhLmNybDAK
  17. BggqhkjOPQQDAgNJADBGAiEAnrequCk/QZOOrcPH6C3Hgcy4SPNUy5rQtku/aYkj
  18. qQoCIQCN6IyYNiXuwG+8jUgJrveiirBjiz2jXZSTEfVAyibjTg==
  19. —–END CERTIFICATE—-

复制代码

/www/server/panel/vhost/cert/default/privkey.pem

  1. —–BEGIN PRIVATE KEY—–
  2. MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgK0HE3hTJQDg6p/fj
  3. nS92eSuRKZEZ5F4grT6tWFKNYVmhRANCAAQIP4WfZQx4/3/tIw0QDdt05DRKiIuO
  4. pghp8GVQ94JcS5fmtZqX1yx0hBU4qZ0skIJr5D2M0BmhCBQ9Kulv2YDL
  5. —–END PRIVATE KEY—–

复制代码

/www/server/panel/vhost/nginx/0.default.conf

  1. server{
  2. listen 80;
  3. listen 443 ssl http2;
  4. server_name _;
  5. #直接用ip访问时重定向为444
  6. if ( $host ~* "d+.d+.d+.d+" ) {
  7.    return 444;
  8. }
  9. #配置无效证书
  10. #HTTP_TO_HTTPS_END
  11. ssl_certificate    /www/server/panel/vhost/cert/default/fullchain.pem;
  12. ssl_certificate_key    /www/server/panel/vhost/cert/default/privkey.pem;
  13. ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
  14. ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
  15. ssl_prefer_server_ciphers on;
  16. ssl_session_cache shared:SSL:10m;
  17. ssl_session_timeout 10m;
  18. error_page 497  https://$host$request_uri;
  19. }

复制代码

fail2ban 装这个插件可以禁止IP
本帖最后由 朔朔 于 2021-11-5 11:01 编辑

用ip新建一个网站,在网站配置文件中加入return 444;

朔朔 发表于 2021-11-5 10:59
用ip新建一个网站,在网站配置文件中加入return 444;

谢谢老哥  没安nginx  得找配置文件

  

有没有一种可能,是本地缓存宝塔不装web如何禁止IP访问宝塔不装web如何禁止IP访问