[英]multiple virtual hosts apache: access from outside LAN?
我已经在服务器(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
在LAN内,我可以访问单个虚拟主机数字化website1.local或website2.local。 在外面,如果我输入servername.dyndns.org,我会到达默认的默认欢迎索引apache或hosts文件中的最后一个!
谢谢。
您必须在客户端计算机上配置/etc/hosts
或/Windows/system32/drivers/etc/hosts
才能访问这些虚拟主机:
<server-ip> website1.local
<server-ip> website2.local
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.