作者:2364118915_86406b_479 | 来源:互联网 | 2014-05-28 10:53
Aapche如果需要绑定多个域名到一个IP上,是支持的。需要注意以下2点:1必须要开启NameVirtualHost开关选项,如:NameVirtualHost220.231.220.231:802NameVirtualHost需要指定具体的端口例如:80,跟VirtualHost220.231.32.*:80对应,否
Aapche 如果需要绑定多个域名到一个IP上,是支持的。需要注意以下2点:
1 必须要开启 NameVirtualHost开关选项,
如:NameVirtualHost 220.231.220.231:80
2 NameVirtualHost 需要指定具体的端口
例如":80",跟对应,否则会报错:
mixing * ports and non-* ports with a NameVirtualHost address is
not supported, proceeding with undefined results。
翻译过来就是: NameVirtualHost 地址,指定端口和不指定端口混合使用是不支持的,将会产生未逾期的后果。
未逾期的后果就是: 第2个不起作用,仅当一个站点设置起作用。
完整的例子:
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost
container.
# The first VirtualHost section is used for requests without a
known
# server name.
#
NameVirtualHost 219.133.61.226:80
ServerAdmin hot@vip.qq.com
DocumentRoot
/usr/local/apache2/htdocs1
ServerName www.server110.com
ErrorLog
logs/server110.com-error_log
CustomLog
logs/linux51.com-access_log common
ServerAdmin hot@vip.qq.com
DocumentRoot
/usr/local/apache2/htdocs2
ServerName www.x.com
ErrorLog
logs/x.com-error_log
CustomLog
logs/x.com-access_log common