2、下载ngx_caucho_vx.x.tar包,解开后包含两个文件:config和ngx_caucho.c;
ngx_caucho.c文件的实现参考了姚伟斌写的nginx_ajp_module模块,具体功能就是实现hmux协议,并把处理过程异步化。
hmux协议可以参考文档 http://www.caucho.com/resin-4.0-javadoc/com/caucho/server/hmux/HmuxRequest.html
-----------------------------------------------------------------------------------------------------------
直接利用nginx的代理(http1.0)来访问resin,据运维人员实践结果,发现这样性能很差,于是中间加了apache这一层,于是变成这样。
后来听说杭州那边写了一个nginx访问tomcat ajp的例子,于是就有了nginx访问resin hmux的需求,于是就有了这个模块。
尽管nginx-->apache-->resin初步解决了问题,但还是会存在如下问题:
b)nginx和apache之间存在着性能问题,由于是http1.0访问,无法保持nginx 和apache之间的连接,在高并发情况下会极大地影响性能
为了解决这些问题,所以尝试着开发此模块来解决上述问题,目前已经在多个项目中应用,希望开源出来大家共同努力把这个模块建设好。
http://code.google.com/p/nginx-hmux-module/
http://code.google.com/u/@UxdXSldXARBMVwl4/
------------------------------------------------------------------------
hmux_pass hdresins; ###只能代理resin无法代理tomcat
----------------------------------------------------------------------------------------------------------
### humx wap
upstream hdresins{
server 192.168.0.217:6800; #记住使用6800端口
}
server {
listen 80;
server_name g.net;
location / {
root /opt/nginx/html;
index index.html index.htm;
}
# location ~* /(shanghai|wuxi|kunshan|guangzhou|haikou|nanning|sanya|chengdu|kunming|chongqing|wuhan|nanchang|changsha|suzhou|nanjing|hangzhou
# |fuzhou|nantong|ningbo|xiamen|changzhou) {
# hmux_pass hdresins;
# }
location ~/ {
hmux_pass hdresins;
# proxy_pass http://hdresins;
}
# location /t1/ {
# alias /data/wwwtest/t1/;
# }
# location ~/t1/ { #不区分大小型
# root /data/wwwtest/;
# }
}
dev_mode : true
resin_doc : true
resin_doc_host :
app_servers : 192.168.0.217:6800 #将原来的127.0.0.1改成本地内网或者外网ip地址
home_cluster : app
app.http : 8082
web.http : 8080
setuid_user :
setuid_group :
port_thread_max : 256
accept_thread_max : 32
accept_thread_min : 4
tcp_cork : true
sendfile : true
keepalive_select_enable : true
proxy_cache_enable : true
session_store : true
web_admin_enable : true
web_admin_host :