【问题标题】:Can I set up a vhost configuration using Apache 2.2.22 like this?我可以像这样使用 Apache 2.2.22 设置虚拟主机配置吗?
【发布时间】:2012-07-15 17:45:02
【问题描述】:

我有 2 个网站正在尝试使用 Apache Vhost 进行设置。网站设置在 IP 地址/文件夹名称,但尚未对外暴露,没有 DNS。因此,当我尝试像这样对它们进行虚拟主机时:

<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,我收到错误"The requested URL /redcreek/ was not found on this server." 一旦我激活了 Vhost 配置文件,就无法识别 IP 地址。

在我注册 DNS 名称之前,是否可以通过这种方式配置 httpd-vhosts.conf

【问题讨论】:

    标签: apache httpd.conf vhosts


    【解决方案1】:

    IPaddress/redcreekIP-address/marion are not valid ServerName identities 因为它不是 FQDN。

    如果您希望能够访问http://ip-address/marionhttp://ip-address/redcreek,那么您应该使用c:/wamp/www/ 的文档根目录创建一个vhose,服务器名称作为IP 地址,并包括&lt;Directory "c:/wamp/www/marion"&gt; 和@ 987654329@ 块。

    一旦您有了 DNS 名称,例如 marion.yourdomain.comredcreek.yourdomain.com,您就可以使用您的设置并将 IP-address/marion 替换为 marion.yourdomain.comIP-address/redcreek 替换为 redcreek.yourdomain.com

    【讨论】:

      猜你喜欢
      • 2011-05-04
      • 2017-06-14
      • 2012-08-22
      • 2011-10-13
      • 1970-01-01
      • 2017-05-30
      • 2013-07-31
      • 2013-03-03
      相关资源
      最近更新 更多