在Windows上为XAMPP设置虚拟主机

时间:2013-10-13 12:44:15

标签: windows-xp xampp virtualhost

XAMPP for Windows 1.8.2 PHP 5.4, 操作系统:windows xp

我在XAMPP上使用用户名和passowrd

C:\ Windows \ System32下\驱动程序\等\主机 127.0.0.1 hindustans.local 127.0.0.1 read.local

E:\ My Projects \ wesites \ read 的index.html

的httpd-vhosts.conf

    <Directory "E:/My Projects/wesites/read">
     Options Indexes FollowSymLinks
     AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>

  <VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs"
    ServerName localhost
  </VirtualHost>
   <VirtualHost *:80>
    DocumentRoot "E:/My Projects/wesites/read"
    ServerName read
    Options +Indexes
    </VirtualHost>

read.local可以正常使用c:\​​ xampp \ htdocs 但 read.local不适用于E:\ My Projects \ wesites \ read \ index.html

我简要想要从E:\ My Projects \ wesites \ read

运行我的项目

1 个答案:

答案 0 :(得分:0)

您需要将ServerName与您在主机中拥有的地址相匹配并授予其权限

<VirtualHost *:80> DocumentRoot "E:/My Projects/wesites/read" ServerName read.local <Directory "E:/My Projects/wesites/read" > Options Indexes FollowSymLinks Includes ExecCGI Order allow,deny Allow from all </Directory> </VirtualHost>

然后尝试访问read.local上的网站。

更多信息here