那天工作需要在服务器上指定ip才可以访问指定端口,配置命令如下: (服务器是ubuntu 14.04系统) apt-get install ufw ufw enable ufw default deny ufw allow from xx.xx.xx.xx to any port 22 只允许ip访问22端口
1. 重启后永久性生效: 开启:chkconfig iptables on 关闭:chkconfig iptables off 2. 即时生效,重启后失效: 开启:service iptables start 关闭:service iptables stop 3.Linux 防火墙开放特定端口 iptables是linux下的防火墙,同时也是服务名称. service iptables status 查看防火墙状态 service iptables start 开启防火墙 service ipt
1. 禁止访问某些文件/目录 增加Files选项来控制,比如要不允许访问 .inc 扩展名的文件,保护php类库: <Files ~ "\.inc$"> Order allow,deny Deny from all </Files> 2.禁止访问某些指定的目录:(可以用 来进行正则匹配) <Directory ~ "^/var/www/(.+/)*[0-9]{3}"> Order allow,deny Deny from all