2012-12-14 84 views

回答

0

Apache支持基於名稱的虛擬主機託管多個站點。您需要爲每個站點創建兩個文件的條目。隨着XAMPP 1.8.1和Vista,例如,如果你想與使用Zend 2框架定期本地主機,並分別制定:

在C:\ XAMPP的\ apache的\的conf \額外\的httpd-vhosts.conf

##<VirtualHost *:80> 
    ##ServerAdmin [email protected] 
    ##DocumentRoot "C:/xampp/htdocs/dummy-host.localhost" 
    ##ServerName dummy-host.localhost 
    ##ServerAlias www.dummy-host.localhost 
    ##ErrorLog "logs/dummy-host.localhost-error.log" 
    ##CustomLog "logs/dummy-host.localhost-access.log" combined 
##</VirtualHost> 

##add these two entries 

<VirtualHost *:80> 
    DocumentRoot "[path to]/xampp/htdocs/" 
    ServerName localhost 
    ServerAlias localhost 
    ErrorLog "logs/localhost-error.log" 
    CustomLog "logs/localhost-access.log" combined 
</VirtualHost> 

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

在C:\ WINDOWS \ SYSTEM32 \ DRIVERS \等\主機

# For example: 
#  102.54.94.97  rhino.acme.com   # source server 
#  38.25.63.10  x.acme.com    # x client host 
#add two entries where name matches ServerName in httpd-vhosts.conf 
127.0.0.1  localhost 
127.0.0.1  zf2-tutorial.localhost 

你可能會需要打開主機,在管理員模式下的文本編輯器來保存更改文件。

然後關閉並重新啓動Apache,然後再進行更改以使其生效。

相關問題