概述
resin 3.1配置:
resin3.1很多配置方法都不同于3.0 , 配置上走了不少弯路.
由于前段是nginx而不是apache,srun端口用不上, nginx只能通过http端口访问resin.
而启动多resin进程只能用${resin_home}/bin/httpd.sh -server a start 这种方式来启动srun端口,
在此把srun端口和http端口绑定起来就可以了.
resin相关配置文件如下:
<server address="127.0.0.1" port="6801">
<http id="" port="8081"/>
</server>
<server id="b" address="127.0.0.1" port="6802">
<http id="" port="8082"/>
</server>
<server id="c" address="127.0.0.1" port="6803">
<http id="" port="8083"/>
</server>
<server id="d" address="127.0.0.1" port="6804">
<http id="" port="8084"/>
</server>
resin启动脚本:
#!/bin/bash
source /data/sh/profile.sh
killall -9 perl
killall -9 java
/usr/local/resin/bin/httpd.sh -server a start
/usr/local/resin/bin/httpd.sh -server b start
/usr/local/resin/bin/httpd.sh -server c start
/usr/local/resin/bin/httpd.sh -server d start
nginx的配置:
http {
upstream resinserver {
server 127.0.0.1:8081 weight=1;
server 127.0.0.1:8082 weight=1;
server 127.0.0.1:8083 weight=1;
server 127.0.0.1:8084 weight=1;
}
include mime.types;
default_type application/octet-stream;
server_names_hash_max_size 128;
server_names_hash_bucket_size 128;
log_format main '$remote_addr - $remote_user [$time_local] $request '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 15;
limit_zone dlconn $binary_remote_addr 20m;
#gzip on;
server {
listen 80;
server_name tt.example.com ;
root /data/webapps/dw_example;
charset utf8;
access_log logs/example.access.log main;
limit_conn dlconn 20;
limit_rate 1m;
location / {
# root html;
index index.html index.htm;
}
location ~ .*/.jsp$ {
proxy_pass http://resinserver;
proxy_redirect off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
最后
以上就是孤独过客为你收集整理的nginx+多resin进程实现负载均衡的全部内容,希望文章能够帮你解决nginx+多resin进程实现负载均衡所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复