设置禁止通过公网ip和端口访问
1 2 3 4 5 6 7 8 9 10 |
NameVirtualHost 192.168.0.12:8880 <VirtualHost 192.168.0.12:8880> ServerName 192.168.0.12:8880 <Location /> Order Allow,Deny Deny from all </Location> </VirtualHost> |
设置ip访问跳转
1 2 3 4 5 6 7 8 |
NameVirtualHost 12.34.56.78:80 <VirtualHost 12.34.56.78:80> ServerName 12.34.56.78 DocumentRoot "/srv/www/default" </VirtualHost> |
禁止某些ip和ip段访问
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
禁止某些IP访问/只允许某些IP访问 如果要控制禁止某些非法IP访问,在Directory选项控制: Order allow,deny Allow from all Deny from 10.0.0.1 #阻止一个IP Deny from 192.168.0.0/24 #阻止一个IP段 只允许某些IP访问,适合比如就允许内部或者合作公司访问: Order deny,allow Deny from all All from example.com #允许某个域名 All from 10.0.0.1 #允许一个iP All from 10.0.0.1 10.0.0.2 #允许多个iP Allow from 10.1.0.0/255.255.0.0 #允许一个IP段,掩码对 All from 10.0.1 192.168 #允许一个IP段,后面不填写 All from 192.168.0.0/24 #允许一个IP段,网络号 |
.htaccess也可以设置禁止ip访问
1 2 |
Order Deny,Allow Deny from 12.34.56.78 |
- 本文固定链接: https://www.yoyoask.com/?p=10770
- 转载请注明: shooter 于 SHOOTER 发表