22.8. Apache mod_proxy HTTP Connector
Apache mod_proxy 는 Cryostat, HTTP 및 HTTPS 프로토콜을 통한 연결을 지원하는 HTTP 커넥터입니다. mod_proxy는 부하 분산 또는 로드 밸런싱이 아닌 구성으로 구성할 수 있으며 고정 세션의 개념을 지원합니다.
mod_proxy 모듈을 사용하려면 사용하려는 프로토콜에 따라 JBoss EAP에 HTTP, HTTPS 또는 Cryostat 리스너가 undertow
하위 시스템에 구성되어 있어야 합니다.
mod_cluster 는 mod_proxy보다 고급 로드 밸런서 장치이며 권장되는 HTTP 커넥터입니다. mod_cluster는 mod_proxy의 모든 기능과 추가 기능을 제공합니다. JBoss EAP mod_cluster HTTP 커넥터와 달리 Apache mod_proxy HTTP 커넥터는 서버 또는 서버 그룹의 배포 상태를 알 수 없으며 그에 따라 작업을 전송하는 위치를 조정할 수 없습니다.
자세한 내용은 Apache mod_proxy 설명서 를 참조하십시오.
22.8.1. Apache HTTP Server에서 mod_proxy 구성
mod_proxy 모듈은 JBoss Core Services Apache HTTP Server를 설치하거나 JBoss Web Server를 사용할 때 이미 포함되어 있으며 기본적으로 로드됩니다.
Apache HTTP Server는 더 이상 JBoss Web Server 버전 3.1.0과 함께 배포되지 않습니다.
기본 로드 밸런싱 또는 비 로드 밸런싱 프록시를 구성하려면 아래 적절한 섹션을 참조하십시오. 이 단계에서는 이미 Apache HTTP Server의 httpd/
디렉토리로 이동했다고 가정하며, 이는 플랫폼에 따라 다릅니다. 자세한 내용은 JBoss Core Services Apache HTTP Server 설치 가이드에서 플랫폼에 대한 설치 지침을 참조하십시오. 이 단계에서는 필요한 HTTP 리스너가 JBoss EAP 하위 시스템에 이미 구성되어 있다고 가정합니다.
Red Hat 고객은 Red Hat 고객 포털에서 로드 밸런서 구성 툴 을 사용하여 mod_proxy 및 기타 커넥터에 대한 최적의 구성 템플릿을 빠르게 생성할 수 있습니다. 이 도구에 액세스하려면 로그인해야 합니다.
비 로드 밸런싱 프록시 추가
가질 수 있는 다른 < VirtualHost
> 지시문 아래에 직접 conf/httpd.conf
파일에 다음 구성을 추가합니다. 설정에 적합한 값으로 바꿉니다.
<VirtualHost *:80> # Your domain name ServerName YOUR_DOMAIN_NAME ProxyPreserveHost On # The IP and port of JBoss # These represent the default values, if your httpd is on the same host # as your JBoss managed domain or server ProxyPass / http://localhost:8080/ ProxyPassReverse / http://localhost:8080/ # The location of the HTML files, and access control information DocumentRoot /var/www <Directory /var/www> Options -Indexes Order allow,deny Allow from all </Directory> </VirtualHost>
<VirtualHost *:80>
# Your domain name
ServerName YOUR_DOMAIN_NAME
ProxyPreserveHost On
# The IP and port of JBoss
# These represent the default values, if your httpd is on the same host
# as your JBoss managed domain or server
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
# The location of the HTML files, and access control information
DocumentRoot /var/www
<Directory /var/www>
Options -Indexes
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
로드 밸런싱 프록시 추가
기본 Apache HTTP Server 구성에는 mod_cluster와 호환되지 않으므로 mod_proxy_balancer.so
모듈이 비활성화되었습니다. 이 작업을 완료하려면 이 모듈을 로드하고 mod_cluster 모듈을 비활성화해야 합니다.
mod_proxy를 로드 밸런서 장치로 사용하고 작업을 여러 JBoss EAP 인스턴스에 보내려면 conf/httpd.conf
파일에 다음 구성을 추가합니다. 예제 IP 주소는 가상입니다. 사용자 환경에 적절한 값으로 바꿉니다.
<Proxy balancer://mycluster> Order deny,allow Allow from all # Add each JBoss Enterprise Application Server by IP address and port. # If the route values are unique like this, one node will not fail over to the other. BalancerMember http://192.168.1.1:8080 route=node1 BalancerMember http://192.168.1.2:8180 route=node2 </Proxy> <VirtualHost *:80> # Your domain name ServerName YOUR_DOMAIN_NAME ProxyPreserveHost On ProxyPass / balancer://mycluster/ # The location of the HTML files, and access control information DocumentRoot /var/www <Directory /var/www> Options -Indexes Order allow,deny Allow from all </Directory> </VirtualHost>
<Proxy balancer://mycluster>
Order deny,allow
Allow from all
# Add each JBoss Enterprise Application Server by IP address and port.
# If the route values are unique like this, one node will not fail over to the other.
BalancerMember http://192.168.1.1:8080 route=node1
BalancerMember http://192.168.1.2:8180 route=node2
</Proxy>
<VirtualHost *:80>
# Your domain name
ServerName YOUR_DOMAIN_NAME
ProxyPreserveHost On
ProxyPass / balancer://mycluster/
# The location of the HTML files, and access control information DocumentRoot /var/www
<Directory /var/www>
Options -Indexes
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
위의 예제는 모두 HTTP 프로토콜을 사용하여 통신합니다. 적절한 mod_proxy 모듈을 로드하는 경우 대신 Cryostat 또는 HTTPS 프로토콜을 사용할 수 있습니다. 자세한 내용은 Apache mod_proxy 설명서 를 참조하십시오.
세션 활성화
고정 세션 은 클라이언트 요청이 원래 특정 JBoss EAP 작업자로 이동하면 사용할 수 없게 되지 않는 한 모든 향후 요청이 동일한 작업자로 전송됨을 의미합니다. 이는 거의 항상 권장되는 동작입니다.
mod_proxy에 대해 고정 세션을 활성화하려면 ProxyPass
문에 고정session
매개변수를 추가합니다.
ProxyPass / balancer://mycluster stickysession=JSESSIONID
ProxyPass / balancer://mycluster stickysession=JSESSIONID
lbmethod
및 nofailover
와 같은 ProxyPass
문에 대한 추가 매개변수를 지정할 수 있습니다. 사용 가능한 매개변수에 대한 자세한 내용은 Apache mod_proxy 설명서 를 참조하십시오.
22.8.2. mod_proxy로 통신하도록 JBoss EAP 구성
JBoss EAP undertow
하위 시스템은 요청을 수락하고 외부 웹 서버로 응답을 다시 전송하기 위해 리스너를 지정해야 합니다. 사용할 프로토콜에 따라 리스너를 구성해야 할 수도 있습니다.
HTTP 리스너는 JBoss EAP 기본 구성에 구성됩니다. 기본 고가용성 구성(ha 또는 full-ha) 중 하나를 사용하는 경우 Cryostat 리스너도 사전 구성됩니다.
자세한 내용은 외부 웹 서버에서 요청 수락을 참조하십시오.