<IfModule mod_authz_core.c> # Apache 2.4 <RequireAny> Require ip xx.xx.xx.xx #在这里加入允许的IP Require ip 127.0.0.1 Require ip ::1 </RequireAny> </IfModule> <IfModule !mod_authz_core.c> # Apache 2.2 Order Deny,Allow Deny from All Allow from xx.xx.xx.xx #在这里加入允许的IP Allow from 127.0.0.1 Allow from ::1 </IfModule> </Directory>