xampp内建apache服务器,也是可以配置vhosts的
1. 打开httpd.conf文件,搜索vhosts
发现这句话:
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
2. 找到httpd-vhosts.conf文件
打开,代码如下:
##<VirtualHost *:80> ##ServerAdmin webmaster@dummy-host2.example.com ##DocumentRoot "D:/xampp/htdocs/dummy-host2.example.com" ##ServerName dummy-host2.example.com ##ErrorLog "logs/dummy-host2.example.com-error.log" ##CustomLog "logs/dummy-host2.example.com-access.log" common ##</VirtualHost>
都是注释的,取消注释,然后配置一下域名,比如我的域名为lumen.app
配置如下:
<VirtualHost *:80> ServerAdmin jaynaruto@qq.com DocumentRoot "D:/xampp/htdocs/lumen/public" ServerName lumen.app ##ServerAlias www.dummy-host.example.com ErrorLog "logs/lumen.app-error.log" CustomLog "logs/lumen.app-access.log" common </VirtualHost>
3. 当然最后需要在hosts文件中新增一条记录:
127.0.0.1 lumen.app