Apache的安装
#yum -y install httpd
关闭防火墙和se
#service iptables stop
#setenforce 0
配置基于ip的虚拟主机
为虚拟主机创建目录:
#mkdir /var/www/wg
#mkdir /var/www/bw
新建测试页面
#vim /var/www/wg/index.html
This is wg!!!
#vim /var/www/bw/index.html
This is bw!!!
修改主配置文件:
#vi /etc/httpd/conf/httpd.conf
<VirtualHost 192.168.152.131:80>
DocumentRoot /var/www/wg
ServerName www.wg.com
###bw####
<VirtualHost 192.168.152.132:80>
DocumentRoot /var/www/bw
ServerName www.bw.com
添加IP地址:
#ifconfig eth0:0 192.168.152.132
#ifconfig eth0:1 192.168.152.131
重启apache并测试:
#service httpd restart
#elinks 192.168.152.131 --dump
this is wg!!!
#elinks 192.168.152.132 --dump
this is bw!!!
或者浏览器中测试: