Apache添加虚拟主机,在XAMPP下测试成功!

一、打开xampp\apache\conf下的httpd.conf,添加网站目录的访问权限:

<Directory "E:/Program Files/tuan">
    Order allow,deny
    Allow from all
</Directory>

二、打开apache\conf\extra\httpd-vhosts.conf,添加:

<VirtualHost *:80>
    ProxyPreserveHost On
    DocumentRoot "E:/Program Files/tuan"
    ServerName  tuan.jxbot.com
    DirectoryIndex index.php
    <Directory "E:/Program Files/tuan">
     Options Indexes FollowSymLinks
     AllowOverride None
     Order allow,deny
     Allow from all
 </Directory>
</VirtualHost>

三、重启Apache。