Apache服务器——基于IP的虚拟主机

1 安装

yum install -y httpd

2 配置网卡

ifconfig ens33     192.168.43.182

ifconfig ens33:2  192.168.43.192

ifconfig ens33:3  192.168.43.202

网络设置

3 配置网页

mkdir -p /home/www

cd /home/www

mkdir html{1,2,3}

echo "192.168.43.182" >html1/index.html

echo "192.168.43.192" >html2/index.html

echo "192.168.43.202" >html3/index.html

网页配置

4 主配置文件

vim /etc/httpd/conf/httpd.conf

vim /etc/httpd/conf/httpd.conf

5 启动与测试

systemctl start httpd

测试1

192.168.43.182

测试2

192.168.43.192

测试3

192.168.43.202

猜你喜欢

转载自blog.csdn.net/VictoryKingLIU/article/details/82695757