apache 限制访问IP

写入 Apache 的配置文件「httpd.conf」或者网站根目录下的「.htaccess」都可以。
操作之前记得先备份配置文件!
 
<Files "wp-login.php">
    Order Deny,Allow
    Deny from all
    Allow from 192.168.2.1
</Files>
只允许某 IP 地址段「192.168.2.*」访问,则为:
 
<Files "wp-login.php">
    Order Deny,Allow
    Deny from all
    Allow from 192.168.2
</Files>
允许多个 IP 地址「192.168.2.1」「192.168.2.2」访问,则为:
 
<Files "wp-login.php">
    Order Deny,Allow
    Deny from all
    Allow from 192.168.2.1 192.168.2.2
</Files> 
posted @ 2020-06-22 18:20  sonydafa  阅读(317)  评论(0)    收藏  举报