同一IP,不同端口的情况:
一、在主机配置文件httpd.conf中增加一个虚拟主机监听的端口(如:Listen 9091),不会覆盖原Listen port;
二、httpd.conf中开启
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
三、httpd-vhosts.conf
1、
NameVirtualHost 192.168.0.37:9091
2、
<VirtualHost 192.168.0.37:9091>
ServerAdmin test@163.com
DocumentRoot "E:"
ServerName 192.168.0.37
</VirtualHost>
3、
<VirtualHost 192.168.0.37:9091>
ServerAdmin test@163.com
#虚拟主机目录
DocumentRoot "E:/c"
#虚拟主机目录设置允许全部,不然会出现403错误
<directory "E:/c">
allow from all
</directory>
ServerName 192.168.0.37
</VirtualHost>
其它参见手册vhost部分