只要在 httpd.conf上面修改即可,如果用的是phpstudy的话 ,菜单里面的打开 ‘’配置文件‘’ 就可以打开
1.监听多个端口
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 8080
Listen 8081
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
#修改为
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
3.在底部配置域名文件名
NameVirtualHost *:8081
<VirtualHost *:8081>
ServerName localhost:8081
DocumentRoot "E:\programs\phpstudy\WWW2"
</VirtualHost>
NameVirtualHost *:8080
<VirtualHost *:8080>
ServerName localhost:8080
DocumentRoot "E:\programs\phpstudy\WWW"
</VirtualHost>