mkdir /var/www/html/server echo "Successful" > /var/www/html/server/index.html2 打开httpd服务的配置文件,在第161行后面添加下述规则来限制源主机的访问
vim /etc/httpd/conf/httpd.conf
161162 SetEnvIf User-Agent "Firefox" ff=1 163 Order allow,deny 164 Allow from env=ff 165
systemctl restart httpd systemctl enable httpd3 我们只允许IP地址为192.168.10.20的主机访问网站资源,那么就可以在httpd服务配置文件的第161行后面添加下述规则
vim /etc/httpd/conf/httpd.conf
161162 Order allow,deny 163 Allow from 192.168.10.20 164
systemctl restart httpd systemctl enable httpd4 在开始测试之前,还需对防火墙进行设置
firewall-cmd --permanent --zone=public --add-service=http firewall-cmd --reload5 使用其他主机不同浏览器进行测试
在浏览器里输入 主机IP地址/server



