1.关闭防火墙
systemctl status firewalld
禁用SElinux
getenforce
添加IP地址,并激活。
创建网页文件根目录,并定义网页内容
echo 小胖,你咋这么胖呢! > /www/bailunshun/index.html
定义基于IP地址来访问网站的配置文件
<VirtualHost 192.168.32.11:80>
DocumentRoot " /www/bailunshun"
serverName192.168.32.11
ErrorLog " /var/log/httpd /dummy-host.example.com-error_log"
customLog " /var/log/httpd/ dummy-host.example.com-access_log" common
</VirtualHost>
重启服务。
systemctl restart httpd
2.关闭防火墙
systemctl status firewalld
禁用SElinux
getenforce
添加IP地址,并激活。
创建网页文件根目录,并定义网页内容
echo who are you? > /www/xaiopang/index.html
echo wo shi bailunshun!> /www/xaiopang/index.html
定义基于不同IP地址来访问网站的配置文件
[root@localhost conf.d]# vim /usr/share/doc/httpd/httpd-vhosts.conf
[ root@localhost conf.d]# vim www.conf
<VirtualHost 192.168.32.11:80>
DocumentRoot " /www/xiaopang"
serverName192.168.32.11
ErrorLog " /var/log/httpd /dummy-host.example.com-error_log"
customLog " /var/log/httpd/ dummy-host.example.com-access_log" common
</VirtualHost>
<VirtualHost 192.168.32.12:80>
DocumentRoot " /www/dapang"
serverName192.168.32.12
ErrorLog " /var/log/httpd /dummy-host.example.com-error_log"
customLog " /var/log/httpd/ dummy-host.example.com-access_log" common
</VirtualHost>
重启服务。
systemctl restart httpd