首页 > 代码库 > xampp 虚拟机配置

xampp 虚拟机配置

目标:

本地某端口根目录映射到htdoc的一个位置

方法:

1.修改D:\xampp\apache\conf 下的httpd文件,给里面的virtual host增加监听端口

## 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:80Listen 81Listen 82

2.由httpd文件里面的配置可以看到,虚拟机的配置文件路径

# Virtual hostsInclude conf/extra/httpd-vhosts.conf

3.去conf/extra/httpd-vhosts.conf增加虚拟机

NameVirtualHost *:82<VirtualHost *:82>    DocumentRoot "D:/xampp/htdocs/traffic-monitor"</VirtualHost>

4.重启Apache 访问localhost:82 就可以啦