NameVirtualHost是core模块中的一个指令
说明 | 为一个基于域名的虚拟主机指定ip地址和端口 |
语法 | NameVirtualHost addr:port |
作用域 | server config |
状态 | 核心(C) |
模块 | core |
<VirtualHost>指令的参数必须与NameVirtualHost指令的参数完全匹配。
报错示例:
(1)错误的httpd.conf配置:
NameVirtualHost * <VirtualHost *:80> ServerName list.xxx.net DocumentRoot /home/admin/lpmall/htdocs Alias /info/ "/home/admin/newcms/htdocs/info/" </VirtualHost>
(2)错误信息
[admin@v015209 ~/lpmall/bin]$ ./apachectl restart
/opt/taobao/install/httpd/bin/httpd -f /home/admin/lpmall/conf/httpd.conf -k restart
[Thu Sep 20 20:20:28 2012] [error] VirtualHost *:80 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results
(3)如果NameVirtualHost 带上端口,而VirtualHost没带上端口,虽然启动不会像向上面一样报错,但是下面的rewrite规则会失效