JBoss ドメイン モードの前の Nginx

JBoss ドメイン モードの前の Nginx

ドメイン モードで実行されている JBoss EAP 7.2 サーバーがあります。

10.10.26.61 jb-domain-arge (ドメイン コントローラ)

10.10.26.62 jbホストarge(ホストコントローラ)

10.10.26.63 jb-ホスト-arge2(ホストコントローラ)

JBoss ホスト コントローラーの前にリバース プロキシがあります。

10.10.26.60 jb-arge-apc

JBoss 管理対象サーバーは次のとおりです。

jb-ホスト-arge

SG01-H01 (HTTP ポート: 2001)

http://10.10.26.62:2001/jboss-as-helloworld/HelloWorld

SG02-H01 (HTTP ポート: 3001)

http://10.10.26.62:3001/サンプルプロジェクト

SG03-H01 (HTTP ポート: 4001)

http://10.10.26.62:4001/サンプルWebApp

jb-ホスト-arge2

SG01-H02 (HTTP ポート: 2001)

http://10.10.26.63:2001/jboss-as-helloworld/HelloWorld

SG03-H02 (HTTP ポート: 4001)

http://10.10.26.63:4001/サンプルWebApp

次のように、10.10.26.60、http 80 ポート上のすべてのアプリにアクセスします。

こんにちは、こんにちは。

http://10.10.26.60/サンプルプロジェクト

http://10.10.26.60/サンプルWebApp

と私nginx.confは以下の通りです:

# For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/
#   * Official Russian Documentation: http://nginx.org/ru/docs/

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    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  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;

    upstream arge_2001 {
        server 10.10.26.62:2001;
        server 10.10.26.63:2001;
    }
    
    server {
        listen 80;
        server_name arge_2001;
        
        location / {
            proxy_pass http://arge_2001;
        }
    }
    
    upstream arge_3001 {
        server 10.10.26.62:3001;
    }
    
    server {
        listen 80;
        server_name arge_3001;
        
        location / {
            proxy_pass http://arge_3001;
        }
    }
    
    upstream arge_4001 {
        server 10.10.26.62:4001;
        server 10.10.26.63:4001;
    }
    
    server {
        listen 80;
        server_name arge_4001;
        
        location / {
            proxy_pass http://arge_4001;
        }
    }
    
}

答え1

nginx.conf を次のように変更すると、動作するようになりました。

# For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/
#   * Official Russian Documentation: http://nginx.org/ru/docs/

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    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  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;

    upstream arge {
        hash $server_addr$server_port$request_uri consistent;
        
        server 10.10.26.62:2001;
        server 10.10.26.63:2001;
        server 10.10.26.62:3001;
        server 10.10.26.62:4001;
        server 10.10.26.63:4001;
    }

    server {
        listen 80;
        server_name 10.10.26.60;
        
        location / {
            proxy_set_header Host $http_host;
            proxy_set_header X-Forwarded-Host $host;
            proxy_set_header X-Forwarded-Server $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Graylog-Server-URL http://$server_name/;
            proxy_pass       http://arge;
        }
    }
}

関連情報