2012-07-26 57 views
0

我設置了一些Apache虛擬主機。我想從外面訪問它們。我發現了一篇文章,Port-based Apache virtual hosts,這解釋說,你可以告訴每個偵聽特定端口上:從廣域網訪問Apache虛擬主機

Listen 10080 
<VirtualHost *:80 *:10080> 
    DocumentRoot "/Users/.../public_html" 
    ServerName www.foo.com 
    <Directory "/Users/.../public_html"> 
     Options Indexes FollowSymLinks MultiViews 
     AllowOverride None 
     Order deny,allow 
     Allow from all 
    </Directory> 
</VirtualHost> 

每個需要一個Listen <unique port>,我不得不轉發我的路由器上的每個端口。因此,結果將是:

  • http://<my ip address>:10080
  • http://<my ip address>:10081
  • http://<my ip address>:10082
  • 等...

有沒有更好的解決辦法?

回答

1

您正在尋找「基於名稱的虛擬主機」。