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 | # Virtual hosts |
去掉注释符 修改为1
2# Virtual hosts
Include conf/extra/httpd-vhosts.conf
0x03 配置conf/extra/httpd-vhosts.conf
1 | <VirtualHost *:9090> |
最后重启 访问端口就行了
更详细的配置版本: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>