nginx 负载实现session共享 :附nginx+ resin配置、nginx-upstream-jvm-route安装配置

1、下载nginx :

wget http://nginx.org/download/nginx-1.2.6.tar.gz

2、下载 nginx-upstream-jvm-route:

wget http://code.google.com/p/nginx-upstream-jvm-route/downloads/detail?name=nginx-upstream-jvm-route-0.1.tar.gz&can=2&q=

3、安装nginx-upstream-jvm-route 和 nginx:

    文件下载的目录都在/home/soft/中

    cd /home/soft/

  tar -xvf nginx-upstream-jvm-route-0.1.tar.gz
    chown -R root:root /home/soft/nginx_upstream_jvm_route/

    tar -xvf nginx-1.2.6.tar.gz

    chown -R root:root /home/soft/nginx-1.2.6/

安装gcc编译器及相关工具 yum -y install gcc gcc-c++ autoconf automake make
安装相关依赖的模块 yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel

cd /home/soft/nginx-1.2.6/

 patch -p0 < /home/soft/nginx_upstream_jvm_route/jvm_route.patch


./configure --add-module=/home/soft/nginx_upstream_jvm_route/ --with-http_stub_status_module --with-http_ssl_module
make
make install

nginx相关命令,输入如下命令查看

/usr/local/nginx/sbin/./nginx -h

停止nginx

kill -HUP `cat /usr/local/nginx/logs/nginx.pid` 
kill -HUP 'cat /var/run/nginx.pid' 
killall -9 nginx 

4、resin配置修改

resin8080.conf中修改:

      <!-- 注释掉这里 The http port
      <http address="*" port="8080"/> -->


在这里修改:

    <!-- define the servers in the cluster -->

    <server id="web-a" address="127.0.0.1" port="6800">
<http id="" port="8080"/>
    </server>

启动脚本也需要修改,增加参数:

-server web-a start

-server web-a stop