2016-05-22 84 views
0

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

这是我的配置:

1虚拟主机

<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 

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

感谢。

+0

是您使用的网址以达到从LAN之外的那些服务器? –

+0

servername.dyndns.org,但我只达到了Apache的默认索引页面! –

回答

0

你必须在客户端计算机上配置/etc/hosts/Windows/system32/drivers/etc/hosts实现这些虚拟主机:
<server-ip> website1.local
<server-ip> website2.local

相关问题