2013-01-21 61 views
0

我在7WAMP子域别名奇怪的行为

曾做过ZF2-tutorial.localhost的别名窗口使用WAMP,已经在驱动程序/ etc/hosts中添加它 还启用了虚拟主机设定:

Include conf/extra/httpd-vhosts.conf 

已经根据

<VirtualHost *:80> 
    ServerName zf2-tutorial.localhost 
    DocumentRoot /path/to/zf2-tutorial/public 
    SetEnv APPLICATION_ENV "development" 
    <Directory /path/to/zf2-tutorial/public> 
     DirectoryIndex index.php 
     AllowOverride All 
     Order allow,deny 
     Allow from all 
    </Directory> 
</VirtualHost> 

当我打开ZF2-tutorial.localhost它显示了Zend页面如预期设定我的别名在这个文件中。但是,当我试图打开本地主机页面就说明这一点:

Forbidden 

You don't have permission to access/on this server. 

禁止在httpd.conf虚拟主机,可以打开本地主机,但无法打开ZF2-tutorial.localhost

回答

2

可能的复制here

为了能够在启用虚拟主机的情况下访问本地主机,httpd-vhosts.conf中的第一项需要命名为localhost并链接到您的Web根目录。

<VirtualHost *:80> 
    ServerName localhost 
    DocumentRoot "path/to/your/www/folder" 
</VirtualHost> 
<VirtualHost *:80> 
    ServerName zf2-tutorial.localhost 
    DocumentRoot /path/to/zf2-tutorial/public 
    SetEnv APPLICATION_ENV "development" 
    <Directory /path/to/zf2-tutorial/public> 
     DirectoryIndex index.php 
     AllowOverride All 
     Order allow,deny 
     Allow from all 
    </Directory> 
</VirtualHost> 

请参阅Setup Apache to serve multiple sites第三步中的示例。