【问题标题】:multiple virtual hosts apache: access from outside LAN?多个虚拟主机 apache:从外部 LAN 访问?
【发布时间】:2016-09-19 09:18:24
【问题描述】:

我在我的服务器 (servername.dyndns.org) 上配置了 2 个虚拟主机。 如何从外部局域网访问它?

这是我的配置:

第一个虚拟主机

<VirtualHost *:80>
   ServerName website1.local
   DocumentRoot /var/www/website1
   DirectoryIndex index.html index.php
   <Directory "/var/www/website1">
       AllowOverride All
       Allow from All
    </Directory>
</VirtualHost>

第二个虚拟主机

<VirtualHost *:80>
   ServerName website2.local
   DocumentRoot /var/www/website2
   DirectoryIndex index.html index.php
   <Directory "/var/www/website2">
       AllowOverride All
       Allow from All
    </Directory>
</VirtualHost>

文件主机

127.0.0.1   localhost 
127.0.0.1   website1.local
127.0.0.1   website2.local

在局域网内,我可以访问单个虚拟主机数字化 website1.local 或 website2.local。在外面,如果我输入 servername.dyndns.org,我会到达 apache 的默认欢迎索引或 hosts 文件中的最后一个!

谢谢。

【问题讨论】:

  • 您使用哪些 URL 从 LAN 外部访问这些服务器?
  • servername.dyndns.org,但我只能访问 apache 默认索引页面!

标签: apache webserver


【解决方案1】:

您必须在客户端计算机上配置 /etc/hosts/Windows/system32/drivers/etc/hosts 才能访问这些虚拟主机:
&lt;server-ip&gt; website1.local
&lt;server-ip&gt; website2.local

【讨论】:

    猜你喜欢
    • 2011-02-12
    • 1970-01-01
    • 1970-01-01
    • 2013-05-22
    • 2015-03-19
    • 2015-03-11
    • 2015-09-14
    • 2015-12-03
    • 2015-10-06
    相关资源
    最近更新 更多