xampp vhost 虚拟主机设置

Xampp Vhost 虚拟主机设置,可用于在本机做php+mysql环境测试!
Edit:
C:xamppapacheconfextrahttpd-vhosts.conf
Add:

NameVirtualHost *:80
<VirtualHost *:80>
    ServerAdmin postmaster@service-labs.com
    DocumentRoot "C:/xampp/htdocs/test"
    ServerName test.service-labs.com
    ServerAlias test.service-labs.com
    ErrorLog "logs/test.service-labs.com-error.log"
    CustomLog "logs/test.service-labs.com-access.log" combined
</VirtualHost>
<VirtualHost *:80>
    ServerAdmin postmaster@service-labs.com
    DocumentRoot "C:/xampp/htdocs"
    ServerName service-labs.com
    ServerAlias www.service-labs.com
    ErrorLog "logs/www.service-labs.com-error.log"
    CustomLog "logs/www.service-labs.com-access.log" combined
</VirtualHost>

保存,重启apache,OK!

备注:
Edit:
C:WINDOWSsystem32driversetchosts
Add:
127.0.0.1 localhost
127.0.0.1 www.service-labs.com
127.0.0.1 test.service-labs.com
这样就可以本机测试了!

上一篇: