在xampp中设置虚拟主机,won7

时间:2014-08-12 13:19:03

标签: apache webserver xampp

我在D盘中安装XAMPP(OS:win 7)。文档根目录是D:/ xampp / htdocs 当我打开localhost / xampp /然后打开它。没问题

我创建了虚拟主机zf2.local,它正常工作。

<VirtualHost zf2.local:80>
    ServerAdmin webmaster@localhost
    DocumentRoot "D:/xampp/htdocs/WORK/zend/public"
    ServerName zf2.local
</VirtualHost>

但是,当我按照下面的方式进行配置时,它会显示为禁止

<VirtualHost zf2.local:80>
    ServerAdmin webmaster@localhost
    DocumentRoot "D:/WORK/zend/public"
    ServerName zf2.local
</VirtualHost>

实际上我想在htdocs&amp;之外设置文档根目录。两者都应该工作意味着localhost和虚拟主机。请帮帮我。

2 个答案:

答案 0 :(得分:0)

<VirtualHost *>
    ServerAdmin admin@localhost.com
    DocumentRoot "C:/xampp/htdocs" # change this line with your htdocs folder
    ServerName localhost
    ServerAlias localhost
        <Directory "C:/xampp/htdocs">
            Options Indexes FollowSymLinks Includes ExecCGI
            Order allow,deny
            Allow from all
        </Directory>
</VirtualHost>

阅读this article以获取进一步的帮助

答案 1 :(得分:0)

这可以解决您的问题:

<Directory "D:/WORK/zend/public">
    Options Indexes FollowSymLinks Includes ExecCGI
    Order allow,deny
    Allow from all
    Require all granted
  </Directory>

OR

<Directory "D:/WORK/zend/public">
    Allow from all
    Require all granted
  </Directory>