【发布时间】: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 默认索引页面!