我设置了一些 Apache 虚拟主机。我想从外部访问它们。我找到了一篇文章Port-based Apache virtual hosts,它解释了您可以告诉每个人在特定端口上侦听:
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
- ETC...
有更好的解决方案吗?