我正在使用命名的虚拟主机
NameVirtualHost *:80
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "/usr/local/apache2/docs/thegeekstuff" ServerName test1.mydomain.com ServerAlias www.test1.mydomain.com ErrorLog "logs/thegeekstuff/error_log" CustomLog "logs/thegeekstuff/access_log" common </VirtualHost> <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "/usr/local/apache2/docs/top5freeware" ServerName test2.mydomain.com ServerAlias www.test2.mydomain.com ErrorLog "logs/top5freeware/error_log" CustomLog "logs/top5freeware/access_log" common </VirtualHost>
目前我还没有定义www.mydomain.com但是当我在浏览器打开它去我test1.mydomain.com
有什么办法,如果我没有明确定义它redirect到任一APache conf页面
另外,如果我只inputIP地址,那么它也去那个网站。
我也想去那个undefiend页面或别的东西
当没有<VirtualHost>匹配的NameVirtualHost时,获取服务的站点是第一个加载的NameVirtualHost 。
只需将一个<VirtualHost>块放在其他人的<VirtualHost> ServerName之上,这个ServerName就是你想要默认的内容。