安装步骤:
1、进入你nginx安装包的目录下:cd nginx-0.8.20
2、#patch -p0 < ../nginx_upstream_jvm_route/jvm_route.patch (nginx安装包和nginx_upstream_jvm_route在同一目录,否则写全路径)3、#./configure --prefix=prefix=/usr/local/nginx --add-module=/opt/nginx_upstream_jvm_route (我的nginx_upstream_jvm_route包在opt下)
4、make
5、sudo make install
若想同时安装多个功能模块编译时可以用这个,还是比较全的:
# ./configure --prefix=/usr/local/nginx --add-module=../nginx_mod_h264_streaming-2.2.7 --add-module=../nginx-upstream-jvm-route-read-only --with-http_stub_status_module --add-module=../nginx-rtmp-module-master/ --with-debug --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_sub_module --with-http_realip_module
常见问题:
root@nginx01 nginx-1.4.1]# patch -p0 < ../nginx_upstream_jvm_route/jvm_route.patch
patching file src/http/ngx_http_upstream.c
Hunk #1 succeeded at 4435 (offset 698 lines).
Hunk #2 succeeded at 4527 (offset 698 lines).
Hunk #3 succeeded at 4567 (offset 698 lines).
Hunk #4 succeeded at 4620 (offset 698 lines).
Hunk #5 succeeded at 4666 (offset 698 lines).
patching file src/http/ngx_http_upstream.h
Hunk #1 succeeded at 90 (offset 5 lines).
Hunk #2 succeeded at 103 (offset 5 lines).
Hunk #3 FAILED at 113.
1 out of 3 hunks FAILED -- saving rejects to file src/http/ngx_http_upstream.h.rej
解决方法:
此问题可能是nginx_upstream_jvm_route版本和nginx不兼容,可以通过
svn checkout http://nginx-upstream-jvm-route.googlecode.com/svn/trunk/ nginx-upstream-jvm-route-read-only
检测下载最新合适的nginx_upstream_jvm_route,然后重新按照以上安装步骤编译安装。
有时编译后可能报另一个报错,这时可以用一个全新的nginx的安装包重新编译安装即可。