Apache2.0+Resin3.0配置虚拟主机的问题
因为本人的服务器需要支持php和servlet,所以我原先的配置是apache2.0+php+resin2.1,通过<IfModule mod_caucho.c>的方式将针对servlet的请求送到resin。这样做也没什么大毛病,不好的地方是我在<IfModule mod_caucho.c>中指定的路径不能针对每个虚拟主机,比如我指定/member来处理servlet,那么只要是这台apache上面的虚拟主机只要含有/member这个路径,都会送到resin去,所以显然这是不合理的。
今天把resin升级到了3.0.9,resin现在对虚拟主机的配置好了很多,允许在resin端也指定虚拟主机,现在我已经可以把指定的虚拟主机servlet发送到resin去了。但是有一个很奇怪的问题。
比如我定义了www.test.com这么一个虚拟主机,在httpd.conf中增加如下配置
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "d:/test/htdocs"
ServerName www.test.com
ErrorLog logs/error_log
ResinConfigServer 127.0.0.1 6802
</VirtualHost>
在resin.conf中配置如下
<host id='dev.torock.com'>
<document-directory>d:/test/htdocs</document-directory>
<!-- configures an explicit root web-app -->
<web-app id='/servlet' document-directory="d:/test/htdocs"/>
</host>
那么www.test.com/servlet/开头的请求都会被认为是servlet请求,但是原先一些静态文件,比如www.test.com/images/logo.jpg这样的文件似乎也被送到了resin,而不是由apache来处理了,我试过如果单独开apache而不开resin的时候,这些文件都能被找到,一打开resin就不行了,同时我打开了resin的debug.log,可以看到这样的log
[02:10:36.062][6] start request
[02:10:36.062][6] U:uri /images/logo.jpg
[02:10:36.062][6] m:method GET
[02:10:36.062][6] c protocol: HTTP/1.1
[02:10:36.062][6] v server-host: www.test
[02:10:36.062][6] g server-port: 80
[02:10:36.062][6] h 127.0.0.1
[02:10:36.062][6] i 127.0.0.1
[02:10:36.062][6] j remote-port: 58386
[02:10:36.062][6] H Accept=*/*
[02:10:36.062][6] H Accept-Language=zh-cn
[02:10:36.062][6] H Accept-Encoding=gzip, deflate
[02:10:36.062][6] H User-Agent=Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; MyIE2; Maxthon)
[02:10:36.062][6] H Host=www.test.com
[02:10:36.062][6] H Connection=Keep-Alive
[02:10:36.062][6] H Cache-Control=no-cache
[02:10:36.062][6] H Cookie=JSESSIONID=a23qmGxg1yYb
[02:10:36.062][6] Q: end of request
[02:10:36.093][6] s 404 Not Found
[02:10:36.093][6] H Content-Length
[02:10:36.093][6] S 1070
[02:10:36.093][6] H Content-Type
[02:10:36.093][6] S text/html
[02:10:36.093][6] G
[02:10:36.093][6] chunk: 1070
[02:10:36.093][6] D:data 1070
[02:10:36.093][6] Q: quit channel
[02:10:36.093][6] complete request - keepalive
[02:10:36.093][6] start request
网上关于resin3.0配置的资料很少,resin自带的文档也没提到这个事情,郁闷啊,哪位牛人能帮俺解决的,100份送上,不够的话再加:)