1.打开apache的配置文件
httpd.conf下面:Include conf/extra/httpd-vhosts.conf 去掉前面注释
2.添加监听端口
#Listen 12.34.56.78:80
Listen 80
Listen 8008 (如果不好使 就把IP加上 Listen IP:8008) 端口可以随便写 只要没有被占用就可以
3.配置vhost文件
<VirtualHost *:8008>(注意修改端口)
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "目录路径"
ServerName localhost
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>
4.重启服务 即可