1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#虚拟域名,新建 httpd-vhosts.conf 文件
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "D:/wamp/apps/mobile"
ServerName m.tzb.com
ServerAlias m.tzb.com

<Directory "D:/wamp/apps/mobile">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Allow from all
</Directory>
</VirtualHost>

#多端口,新建 httpd-more-port.conf 文件
Listen 84
NameVirtualHost *:84
<VirtualHost *:84>
DocumentRoot "D:/wamp/apps/mobile"

<Directory "D:/wamp/apps/mobile">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Allow from all
</Directory>
</VirtualHost>

然后在 http.conf 中导入

1
2
3
4
5
# Virtual hosts
Include conf/extra/httpd-vhosts.conf

# More port
Include conf/extra/httpd-more-port.conf

重启apache后,本地既可以用 m.tzb.com访问,也可以用 127.0.0.1:84 访问,
局域网用 ip + port 访问,如我的ip是192.168.1.128,用 192.168.1.128:84 即可。