2012-07-16 209 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