2016-05-22 89 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

相關問題