建立两个基于ip地址访问的网站,要求如下:
1、该网站ip地址的主机位为100,设置DocumentRoot为/www/ip/100,网页内容为:this is 100。
2、该网站ip地址主机位为200,设置DocumentRoot为/www/ip/200,网页内容为:this is 200。
配置网卡
nmcli
cd /etc/sysconfig/network - scripts
配置ip
cd /etc/sysconfig/network-scripts/
nmcli connection add con-name static ifname ens160 type ethernet
nmcli connection add con-name ens256 ifname ens256 type ethernet
nmcli connection show
在这里插入图片描述
vim host100.conf
第一行改为<virtualhost 192.168.168.100:80>
第二行删掉
现第二行改为DocumentRoot /www/ip/100
第三行:Errorlog “/var/log/httpd/100_error_log”
第四行:Customlog “/var/log/httpd/100_access_log” common
光标移到最后,空一行,输入:
<directory /www/ip/100>
allowoverride none
require all granted
:wq
Mkdir -p /www/ip/100
Cd //www/ip/100/
Systemctl restart httpd
Systemctl status firewalld
Curl -I 192.168.168.100
Cat /etc/selinux/config
Setenforce 0
第二个同理
创建文件根目录
mkdir -pv /www/ip/{100,200}
echo this is 100 > /www/ip/100/index.html
echo this is 200 > /www/ip/200/index.html
setenforce 0
getenforce
这里是引用