[php] How to create multi websites in XAMPP

2016-7-18 写技术

1.Edit C:\Windows\System32\Drivers\etc\hosts
  Expand with:
 127.0.0.1 www.test.com
 127.0.0.1 www.test2.com


2.Edit xampp\apache\conf\extra\httpd-vhosts.conf
  Add contents like:

 NameVirtualHost *:80

 <VirtualHost *:80>
   DocumentRoot /xampp/htdocs/test
   ServerName www.test.com
 </VirtualHost>

 <VirtualHost *:80>
   DocumentRoot /xampp/htdocs/test2
   ServerName www.test2.com
 </VirtualHost>

3.Allow access a directory not xampp

 <VirtualHost *:80>
   DocumentRoot D:\test
   ServerName www.test.com
   <Directory D:\test>
     Order allow,deny
     Allow from all
   </Directory>
 </VirtualHost> 

标签: php html

发表评论:

Powered by anycle 湘ICP备15001973号-1