我试图通过ip限制apache。
我在我的IP上测试,如果通过屏蔽自己或只接受其他IP。
Apache重新启动了,我真的不知道可能是哪个问题
尽管有限制,我还是可以访问页面
我在网上找到的所有例子如下:
<Location /home>
SetEnvIf X-Forwarded-For ^xxx.xxx.xxx.xxx access
Order allow,deny
Satisfy Any
Allow from env=access
</Location>
<Location /home>
Order Deny,Allow
Deny from All
Allow from xxx.xxx.xxx.xxx
Deny from All
Satisfy Any
</Location>
<ProxyMatch "/home/*" >
Order Deny,Allow
Deny from all
Allow from xxx.xxx.xxx.xxx
</ProxyMatch>
<LocationMatch "/home">
Order Allow,Deny
Allow from all
SetEnvif X-Forwarded-For "xxx.xxx." DenyAccess
Deny from env=DenyAccess
</LocationMatch>
<Location "/home">
Order Allow,Deny
Allow from all
SetEnvIf X-Forwarded-For ^xxx.xxx. denyAccess
Deny from env=denyAccess
</Location>
<Location "/home">
SetEnvIf X-Forwarded-For ^xxx.xxx. access
Order allow,deny
Satisfy Any
Allow from env=access
</Location>
感谢
您可以通过Require not ip xxx.xxx.xxx.xxx指令执行此操作此处的文档:https://httpd.apache.org/docs/2.4/howto/access.html
Apache2.4使用Require
具有不同的结构
<Files /home>
Require all granted
Require not ip xx.xx.xx.xx
</Files>