通过http:// ipclosures对网站的访问,但允许通过http://域

我不得不通过ipclosures访问网站(通过http://203.0.113.11closures访问),但通过域访问应该仍然可用。

我已阅读http://httpd.apache.org/docs/2.0/vhosts/name-based.html (“ Using Name-based Virtual Hosts ),按照build议进行configuration:

 NameVirtualHost *:80 <VirtualHost *:80> ServerName www.domain.tld ServerAlias domain.tld *.domain.tld DocumentRoot /www/domain </VirtualHost> 

重启httpd,但是这个VirtualHost仍然可以通过ip。

我究竟做错了什么?

您的apache将始终使用第一个虚拟主机作为默认主机。

因此,在任何其他虚拟主机之前,创build另一个虚拟主机configuration中不存在的所有访客打到一个主机名。