dubbo-nginx-module-plus

Configure Binary Package Repository

First, we need to configure the binary package repository. Follow the commands below to configure it. (Replace CLIENT_TOKEN in the commands with the valid token from the subscription email)

For Ubuntu/Debian/CentOS/Rocky/Red Hat Enterprise Linux/Fedora OS/Alibaba Cloud Linux/Tencent Linux systems:

curl -o get-xray-priv-lib-repo.sh https://pkg2.openresty.com/scripts/get-xray-priv-lib-repo.sh

sudo bash get-xray-priv-lib-repo.sh -l dubbo-nginx-module-plus -t CLIENT_TOKEN

For Alpine OS:

curl -o get-xray-priv-lib-repo.sh https://pkg2.openresty.com/scripts/get-xray-priv-lib-repo.sh

sudo sh get-xray-priv-lib-repo.sh -l dubbo-nginx-module-plus -t CLIENT_TOKEN

Installation

For OpenResty 1.25.3.x

For systems using the yum package manager, run the following command to install from the private repo:

sudo yum install --disablerepo="*" --enablerepo=dubbo-nginx-module-plus -y dubbo-nginx-module-plus-1.25.3

For systems using the dnf package manager, run the following command to install from the private repo:

sudo dnf install --disablerepo="*" --enablerepo=dubbo-nginx-module-plus -y dubbo-nginx-module-plus-1.25.3

For systems using the apt package manager, run the following command to install from the private repo:

sudo apt-get install -y dubbo-nginx-module-plus-1.25.3

For alpine OS, run the following command to install from the private repo:

sudo apk add dubbo-nginx-module-plus-1.25.3

Recompile OpenResty

Patch OpenResty

Download and extract the OpenResty source package, then execute the following command in the nginx-NGINX_VER directory of the OpenResty source package to apply the patch. Assume the patch file ngx-multi-upstream-module-NGINX_VER.patch is in the current directory.

For example:

topdir=$(pwd)

wget https://openresty.org/download/openresty-1.25.3.2.tar.gz
tar -xzvf openresty-1.25.3.2.tar.gz
cd openresty-1.25.3.2/bundle/nginx-1.25.3
cat $topdir/ngx-multi-upstream-module-1.25.3.patch | patch -p1
cd $topdir
tar -czf openresty-1.25.3.2.tar.gz openresty-1.25.3.2

Recompile

Recompile OpenResty according to the original compilation method.

Nginx Configuration Example

load_module /usr/local/openresty/nginx/modules/ngx_http_multi_upstream_module.so;
load_module /usr/local/openresty/nginx/modules/ngx_stream_multi_upstream_module.so;
load_module /usr/local/openresty/nginx/modules/ngx_http_dubbo_module.so;

http {
    access_log logs/access.log;

    default_type text/plain;
    keepalive_timeout  68000ms;

    upstream dubbo_backend {
        multi 1;
        server 127.0.0.1:20880;
    }

    server {
        listen          1984;
        server_name     'localhost';

        client_max_body_size 30M;

        location /test {
            dubbo_pass_all_headers on;
            dubbo_pass_set args $args;
            dubbo_pass_set uri $uri;
            dubbo_pass_set method $request_method;

            dubbo_pass org.apache.dubbo.samples.tengine.DemoService 0.0.0 tengineDubbo dubbo_backend;
        }
    }
}

Dubbo Configuration Directives

Please refer to the Dubbo User Manual document.