2012-07-16 59 views
0

我有2個網站我正在嘗試使用Apache Vhost進行設置。這些網站設置爲IP地址/文件夾名稱,但尚未公開到外部,沒有DNS。所以,當我嘗試VHOST他們是這樣的:我可以像這樣使用Apache 2.2.22來設置虛擬主機配置嗎?

<VirtualHost *:80> 

    DocumentRoot "c:/wamp/www/marion" 
    ServerName IP-address/marion 

    <Directory "c:/wamp/www/marion"> 

     Options Indexes FollowSymLinks 
      AllowOverride all 
      Order Allow,Deny 
     Allow from all 

    </Directory> 

</VirtualHost> 

<VirtualHost *:80> 

    DocumentRoot "c:/wamp/www/redcreek" 
    ServerName IP-address/redcreek 

    <Directory "c:/wamp/www/redcreek"> 

     Options Indexes FollowSymLinks 
      AllowOverride all 
      Order Allow,Deny 
     Allow from all 

    </Directory> 

</VirtualHost> 

並瀏覽到任何網站,如IPaddress/redcreek,我得到它像IP地址不能被識別的錯誤"The requested URL /redcreek/ was not found on this server."一旦我激活的虛擬主機配置文件。

是否可以通過這種方式配置httpd-vhosts.conf直到我註冊了DNS名稱?

回答

1

IPaddress/redcreekIP-address/marionare not valid ServerName identities因爲它不是FQDN。

如果您希望能夠訪問http://ip-address/marionhttp://ip-address/redcreek那麼你應該在c:/wamp/www/使與文檔根單vhose,該服務器名稱爲IP地址,並同時包括<Directory "c:/wamp/www/marion"><Directory "c:/wamp/www/redcreek">塊。

一旦你有了DNS名稱,就好說了,marion.yourdomain.comredcreek.yourdomain.com,你可以用你的設置和更換IP-address/marionmarion.yourdomain.comIP-address/redcreekredcreek.yourdomain.com

+0

謝謝,這很好。 – jamesTheProgrammer 2012-07-17 19:29:23