Twosmi1e's Blog.

WampServer多端口配置

Word count: 224 / Reading time: 1 min
2018/10/04 Share

0x00 背景

做项目有的文件必须放在网站根目录,于是需要配置多端口,找了网上几种方法都没成功,记下最后成功的办法。

0x01 修改http.conf

在监听端口处加Listen 端口号
example:

1
2
3
4
#Listen 12.34.56.78:80
Listen 0.0.0.0:90
Listen [::0]:90
Listen 9090

0x02 开启虚拟站点

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

去掉注释符 修改为

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

0x03 配置conf/extra/httpd-vhosts.conf

1
2
3
4
<VirtualHost *:9090>
ServerName test01.com
DocumentRoot D:/demo/test01
</VirtualHost>

最后重启 访问端口就行了
更详细的配置版本:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<VirtualHost *:8082> 
ServerAdmin webmaster@dummy-host.localhost
DocumentRoot "C:/PhpDocRoot/Site1"
ServerName localhost
ServerAlias localhost
ErrorLog "logs/dummy-host.localhost-error.log"
CustomLog "logs/dummy-host.localhost-access.log" common
<Directory "C:/PhpDocRoot/Site1">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

CATALOG
  1. 1. 0x00 背景
  2. 2. 0x01 修改http.conf
  3. 3. 0x02 开启虚拟站点
  4. 4. 0x03 配置conf/extra/httpd-vhosts.conf