2013-01-21 95 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第三步中的示例。