搭建自定义的一个web网站----案例
同时建立一个192.168.220.138的网站,文件放在/www/100,显示内容为 this is 192.168.220.138和
一个192.168.220.130的网站,文件放在/www/200,显示内容为 this is 192.168.220.130
1、挂载镜像
[[email protected] ~]# mount /dev/sr0 /mnt
2、配置yum源
[[email protected] ~]# vim /etc/yum.repos.d/base.repo
3、安装http服务
[[email protected] ~]# yum install httpd -y
4、开启服务、查看服务状态
[[email protected] ~]# systemctl restart httpd
[[email protected] ~]# setenforce 0
5、配置网络
6、创建目录,添加内容
[[email protected] ~]# mkdir /www/{100,200} -pv
mkdir: created directory ‘/www’
mkdir: created directory ‘/www/100’
mkdir: created directory ‘/www/200’
[[email protected] ~]# echo this is 192.168.220.138 > /www/100/index.html
[[email protected] ~]# echo this is 192.168.220.130 > /www/200/index.html
7、进入子配置文件编辑
[[email protected]~]#vim /etc/httpd/conf.d/vhosts.conf
8、重启http服务
[[email protected] ~]# systemctl restart httpd
[[email protected] ~]# systemctl status httpd 查看服务状态
9、测试