apache路由配置jboss


Apache路由配置多台JBoss服务器,以下配置按两台JBoss服务器为例。

a) 修改/opt/aspire/product/mid/apache/conf/httpd.conf
在文档中找到Listen 80,修改此端口。并在此行下面添加如下内容:
##################################################################### mid config from here {{

Timeout 300
KeepAlive On
MaxKeepAliveRequests 1000
KeepAliveTimeout 60

#LoadModule encoding_module modules/mod_encoding.so
#
#Header add MS-Author-Via "DAV"
#

#
# EncodingEngine on
# NormalizeUsername on
# SetServerEncoding GBK
# DefaultClientEncoding UTF-8 GBK GB2312
# AddClientEncoding "(Microsoft .* DAV $)" UTF-8 GBK GB2312
# AddClientEncoding "Microsoft .* DAV" UTF-8 GBK GB2312
# AddClientEncoding "Microsoft-WebDAV*" UTF-8 GBK GB2312
#


LoadModule fileiri_module modules/mod_fileiri.so

FileIRI On
FilenameCharset GB2312


LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

#turning ProxyRequests on and allowing proxying from all may allow
#spammers to use your proxy to send email.
ProxyRequests Off

#Do not proxy balancer-manager
#ProxyPass /balancer-manager !

#下载应用地址的配置,只能配置一台子节点机器的地址
ProxyPass /middls http://10.1.4.52:8095/middls
ProxyPassReverse /middls http://10.1.4.52:8095/middls

#JSESSIONID|BALANCEID
ProxyPass / balancer://mycluster/ stickysession=JSESSIONID nofailover=On
ProxyPassReverse / balancer://mycluster/

#子节点机器一IP、Port;
#route对应子节点机器一jboss的配置
BalancerMember http://10.1.4.52:8095 route=server1
#子节点机器二IP、Port;
#route对应子节点机器二jboss的配置
BalancerMember http://10.1.5.50:8095 route=server2

SetEnv force-proxy-request-1.0 1
SetEnv proxy-nokeepalive 1


#AddDefaultCharset off
Order deny,allow
#Deny from all
#Allow from .example.com
Allow from all


# Enable/disable the handling of HTTP/1.1 "Via:" headers.
# ("Full" adds the server version; "Block" removes all outgoing Via: headers)
# Set to one of: Off | On | Full | Block
# ProxyVia On


#AddOutputFilterByType DEFLATE text/html text/plain text/xml application/json text/css application/x-javascript application/javascript
include conf/mod_jk.conf


SetHandler balancer-manager
Order Deny,Allow
Deny from all
#Allow from all

# mid config end here }}
####################################################################
b) 修改/opt/aspire/product/mid/apache/conf/httpd.conf找到
ServerName localhost:8090
改为
ServerName 域名:端口

c) 修改/opt/aspire/product/mid/apache/conf/httpd.conf找到
ErrorLog "logs/error_log"
改为
#ErrorLog "logs/error_log"
ErrorLog "|/opt/aspire/product/mid/apache//bin/rotatelogs -l /opt/aspire/product/mid/apache/logs/error-%Y-%W.log 1024M"

LogFormat "%h %l %u %t \"%r\" %>s %b " common
改为
#LogFormat "%h %l %u %t \"%r\" %>s %b " common
LogFormat "%h --> [%v | %A] %l %u %t \"%r\" %>s %b" common

CustomLog "logs/access_log" common
改为
#CustomLog "logs/access_log" common
CustomLog "|/opt/aspire/product/mid/apache/bin/rotatelogs -l /opt/aspire/product/mid/apache/logs/access-%Y-%W.log 1024M" common

d) 修改/opt/aspire/product/mid/apache/conf/httpd.conf找到
# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf
改为
Include conf/extra/httpd-mpm.conf

e) 修改/opt/aspire/product/mid/apache/conf/ workers.properties
worker.list=server1,server2,balanceworker,jkstatus
worker.maintain=60

worker.server1.type=ajp13
#子节点机器IP
worker.server1.host=10.1.4.52
#子节点机器Port
worker.server1.port=8095
worker.server1.lbfactor=1
worker.server1.socket_keepalive=False
worker.server1.socket_timeout=0

worker.server2.type=ajp13
#子节点机器IP
worker.server2.host=10.1.5.50
#子节点机器Port
worker.server2.port=8095
worker.server2.lbfactor=1
worker.server2.socket_keepalive=False
worker.server2.socket_timeout=0

worker.balanceworker.type=lb
worker.balanceworker.balance_workers=server1,server2
worker.balanceworker.sticky_session=True
worker.balanceworker.sticky_session_force=False
worker.balanceworker.method=Request

worker.jkstatus.type=status

你可能感兴趣的:(Apache)