Sealyu

--- 博客已迁移至: http://www.sealyu.com/blog

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  618 随笔 :: 87 文章 :: 225 评论 :: 0 Trackbacks

在整合Apache和Tomcat之后,发现该服务器的两个网站一个是静态的,一个是动态jsp的,设置总结如下

主要设置httpd.conf

1、DirectoryIndex的设置

如果多个虚拟站点中包含多种文件格式和文件名的首页文件,必须在这里全部出现

2、多个站点的定义如下

#NameVirtualHost *:80

#
# 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 220.231.32.*:80

<VirtualHost 220.231.32.*:80>
    ServerAdmin liubin@sina.com
    DocumentRoot /usr/local/tomcat/webapps/ronglian
    ServerName www.ronglian.com
    ErrorLog logs/ronglian.com-error_log
    CustomLog logs/ronglian.com-access_log common
</VirtualHost>

<VirtualHost 220.231.32.*:80>
    ServerAdmin wellboby@tom.com
    DocumentRoot /usr/local/wwwroot/chinaface
    ServerName www.chinaface.net
    ErrorLog logs/chinaface.net-error_log
    CustomLog logs/chinaface.net-access_log common
</VirtualHost>

!! 在这里,NameVirtualHost的字段不能省略,否则起apache时报错:VirtualHost 220.231.32.*.80 overlaps with VirtualHost 220.231.32.*:80, the first has precedence, perhaps you need a NameVirtualHost directive——虽然apache能起,同错误描述一样,第二个站点的定义被第一个站点的定义所覆盖,即访问第二个站点指向的其实是第一个

!! NameVirtualHost字段的端口号不能忽略,否则起apache时报错:VirtualHost 220.231.32.*:80 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results
[Sun Jul 09 16:59:37 2006] [error] VirtualHost 220.231.32.*:80 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results——apache不能起

!!如果VirtualHost 字段的端口号确实,起apache时报错:VirtualHost 220.231.32.28:0 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results——但apache可以启动,访问也正常

posted on 2008-08-14 14:10 seal 阅读(2870) 评论(1)  编辑  收藏 所属分类: web服务器

评论

# re: Apache设置虚拟站点总结 2012-03-10 12:26 shirne
配置了好久觉得没问题,却总是不行
原来关键点在
NameVirtualHost  回复  更多评论
  


只有注册用户登录后才能发表评论。


网站导航: