2009-08-04 14 views
0

我在本地機器上有一個Zend Framework項目,並建議其/公共子文件夾在httpd.conf中成爲一個DocumentRoot。所以我只需要http://localhost即可訪問這個應用程序。訪問其他webapps,而其中一個在文檔根

這個新需求使我無法訪問其他 網絡應用程序在一個以前的網絡服務器根(其中包含幾個常規的PHP應用程序和幾個zend框架應用程序)。

我應該選擇什麼樣的配置才能同時訪問基於ZF的基於應用程序和PHPMYADMIN等其他應用程序?

回答

4

你可能需要使用某種VirtualHost

您至少有兩種解決方案:


在第二種情況下(溶液我總是用),你將不得不修改「hosts」的文件等「mytestwebsite」是一個別名到本地計算機上 - 這IP地址爲127.0.0.1
下窗戶,這個文件位於C:\WINDOWS\system32\drivers\etc
在Linux上,這是在/etc/

你不得不添加像這些的一行:

127.0.0.1  localhost 
127.0.0.1  mytestwebsite 

然後,在Apache的配置,你需要創建一個VirtualHost p呃網站。像這樣的事情,我想:

<VirtualHost *> 
    ServerName  mytestwebsite 
    DocumentRoot /home/squale/developpement/tests 
    <Directory /home/squale/developpement/tests> 
     Options Indexes FollowSymLinks MultiViews +SymLinksIfOwnerMatch 
     AllowOverride All 
    </Directory> 
</VirtualHost> 

<VirtualHost *> 
    ServerName  myothertestwebsite 
    DocumentRoot /.../myothertestwebsite 
    <Directory /.../myothertestwebsite> 
     Options Indexes FollowSymLinks MultiViews +SymLinksIfOwnerMatch 
     AllowOverride All 
    </Directory> 
</VirtualHost> 

(需要tunning /配置,當然)

而且你還可能會需要一些指令,像這樣的:

NameVirtualHost * 

那麼,這可能不是整個解決方案(這取決於您的服務器/應用程序);但我希望這些指針能幫助你達成目標!

如果您需要更多的幫助,關鍵詞是 「虛擬主機」 ;-)

玩得開心!

+0

工作和指令「NameVirtualHost *」是真正有用的一次有兩個主機。帕斯卡,感謝提高我的PHP生產力! – AlexA 2009-08-04 11:44:59

0

Zend Framework可能使用.htaccess文件。如果是這樣,您可能會使用它來添加規則以保留其他應用程序。另一種選擇是使用子域名(如phpmyadmin.localhost)