Weblogic加Apache的群集配置

本文直接从简了,直接对配置文件进行说明了。

首先,我们要保证我们的weblogic 和apache 服务都已经正常可用了。

1、新增配置 weblogic.xml

为了支持session复制,为应用程序新建weblogic.xml文件,和项目的 web.xml 放在一起,内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.5/weblogic-web-app.xsd">
	<wls:weblogic-version>12.1.2</wls:weblogic-version>
	<wls:context-root>/</wls:context-root>
	<wls:charset-params>
		<wls:input-charset>
			<wls:resource-path>/</wls:resource-path>
			<wls:java-charset-name>UTF-8</wls:java-charset-name>
		</wls:input-charset>
	</wls:charset-params>
	<wls:container-descriptor>
		<!-- <wls:prefer-web-inf-classes>true</wls:prefer-web-inf-classes> -->
		<wls:prefer-application-packages>
			<wls:package-name>javax.ws.rs.*</wls:package-name>
		</wls:prefer-application-packages>
	</wls:container-descriptor>
	<wls:jsp-descriptor>
		<wls:page-check-seconds>5</wls:page-check-seconds>
	</wls:jsp-descriptor>
	<wls:session-descriptor>
		<wls:timeout-secs>7200</wls:timeout-secs>
		<wls:cookie-name>WSESSIONID</wls:cookie-name>
		<wls:persistent-store-type>replicated_if_clustered</wls:persistent-store-type>
	</wls:session-descriptor>
</wls:weblogic-web-app>


2、配置apache

复制weblogic 的 mod_wl_22.so 到 apache/module 目录下。

修改httpd.conf文件,增加如下内容:

<VirtualHost *:80>
    DocumentRoot "/svcrootStg/runtime/webstatic/MobileWAP-Backoffice"
    ServerName stgm.test.com.cn
    #    ServerName www.test.com.cn
    ErrorLog "|/app/apache2/bin/rotatelogs /app/logs/webserver/stgm-error_log.%m%d 86400"
    CustomLog "|/app/apache2/bin/rotatelogs /app/logs/webserver/stgm-access_log.%m%d 86400" common
    <IfModule mod_weblogic.c>
        WebLogicCluster 52.208.110.181:8101,52.208.110.182:8101
        #WebLogicHost cgvch-doap
        #WebLogicPort 8211
        WLCookieName MJSESSIONID
        MatchExpression */controller/*
        MatchExpression *.jsp
        MatchExpression *.fo
        MatchExpression */ws/*
        ConnectTimeoutSecs 4
        ConnectRetrySecs 2
        DynamicServerList ON
        Idempotent OFF
        WLIOTimeoutSecs 40
        Debug OFF
#       WLLogFile /tmp/wlproxy_stgm.log
    </IfModule>
    <Directory "/svcrootStg/runtime/webstatic/MobileWAP-Backoffice">
        AllowOverride None
        Options FollowSymLinks
   #    Options Indexes MultiViews
        Order deny,allow
        Allow from all
    </Directory>

</VirtualHost>

配置的主要意思是:处理所有80端口,并过滤ServerName,只处理 stgm.test.com.cn 的域名请求。WebLogicCluster 为多个weblogic 服务,apache 自动负载均衡转发请求。MatchExpression 配置的为转发到weblogic 的请求规则。不复合配置的规则的,都会被apache 自己处理。


3、apache案例参考

下面是一个项目的 httpd.conf 配置文件,贴出来供参考,主要看最后一段配置就好,就不进行一一解释了。

 

#
# This is the main Apache HTTP server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see 
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. You have been warned.  
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path.  If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so 'log/access_log'
# with ServerRoot set to '/www' will be interpreted by the
# server as '/www/log/access_log', where as '/log/access_log' will be
# interpreted as '/log/access_log'.

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path.  If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk.  If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
#
ServerRoot "/app/apache2"

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to 
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80

#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#

<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.  
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User daemon
Group daemon

</IfModule>
</IfModule>

# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition.  These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#

#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed.  This address appears on some server-generated pages, such
# as error documents.  e.g. admin@your-domain.com
#
ServerAdmin you@example.com

#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName testch-doap:80

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/app/apache2/htdocs"

#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories). 
#
# First, we configure the "default" to be a very restrictive set of 
# features.  
#
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/app/apache2/htdocs">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all

</Directory>

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

#
# The following lines prevent .htaccess and .htpasswd files from being 
# viewed by Web clients. 
#
<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</FilesMatch>

#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "logs/error_log"

#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn

<IfModule log_config_module>
    #
    # The following directives define some format nicknames for use with
    # a CustomLog directive (see below).
    #
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      # You need to enable mod_logio.c to use %I and %O
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>

    #
    # The location and format of the access logfile (Common Logfile Format).
    # If you do not define any access logfiles within a <VirtualHost>
    # container, they will be logged here.  Contrariwise, if you *do*
    # define per-<VirtualHost> access logfiles, transactions will be
    # logged therein and *not* in this file.
    #
    CustomLog "logs/access_log" common

    #
    # If you prefer a logfile with access, agent, and referer information
    # (Combined Logfile Format) you can use the following directive.
    #
    #CustomLog "logs/access_log" combined
</IfModule>

<IfModule alias_module>
    #
    # Redirect: Allows you to tell clients about documents that used to 
    # exist in your server's namespace, but do not anymore. The client 
    # will make a new request for the document at its new location.
    # Example:
    # Redirect permanent /foo http://www.example.com/bar

    #
    # Alias: Maps web paths into filesystem paths and is used to
    # access content that does not live under the DocumentRoot.
    # Example:
    # Alias /webpath /full/filesystem/path
    #
    # If you include a trailing / on /webpath then the server will
    # require it to be present in the URL.  You will also likely
    # need to provide a <Directory> section to allow access to
    # the filesystem path.

    #
    # ScriptAlias: This controls which directories contain server scripts. 
    # ScriptAliases are essentially the same as Aliases, except that
    # documents in the target directory are treated as applications and
    # run by the server when requested rather than as documents sent to the
    # client.  The same rules about trailing "/" apply to ScriptAlias
    # directives as to Alias.
    #
    ScriptAlias /cgi-bin/ "/app/apache2/cgi-bin/"

</IfModule>

<IfModule cgid_module>
    #
    # ScriptSock: On threaded servers, designate the path to the UNIX
    # socket used to communicate with the CGI daemon of mod_cgid.
    #
    #Scriptsock logs/cgisock
</IfModule>

#
# "/app/apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/app/apache2/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value.  If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain

<IfModule mime_module>
    #
    # TypesConfig points to the file containing the list of mappings from
    # filename extension to MIME-type.
    #
    TypesConfig conf/mime.types

    #
    # AddType allows you to add to or override the MIME configuration
    # file specified in TypesConfig for specific file types.
    #
    #AddType application/x-gzip .tgz
    #
    # AddEncoding allows you to have certain browsers uncompress
    # information on the fly. Note: Not all browsers support this.
    #
    #AddEncoding x-compress .Z
    #AddEncoding x-gzip .gz .tgz
    #
    # If the AddEncoding directives above are commented-out, then you
    # probably should define those extensions to indicate media types:
    #
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

    #
    # AddHandler allows you to map certain file extensions to "handlers":
    # actions unrelated to filetype. These can be either built into the server
    # or added with the Action directive (see below)
    #
    # To use CGI scripts outside of ScriptAliased directories:
    # (You will also need to add "ExecCGI" to the "Options" directive.)
    #
    #AddHandler cgi-script .cgi

    # For type maps (negotiated resources):
    #AddHandler type-map var

    #
    # Filters allow you to process content before it is sent to the client.
    #
    # To parse .shtml files for server-side includes (SSI):
    # (You will also need to add "Includes" to the "Options" directive.)
    #
    #AddType text/html .shtml
    #AddOutputFilter INCLUDES .shtml
</IfModule>

#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type.  The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile conf/magic

#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#

#
# MaxRanges: Maximum number of Ranges in a request before
# returning the entire resource, or one of the special
# values 'default', 'none' or 'unlimited'.
# Default setting is to accept 200 Ranges.
#MaxRanges unlimited

#
# EnableMMAP and EnableSendfile: On systems that support it, 
# memory-mapping or the sendfile syscall is used to deliver
# files.  This usually improves server performance, but must
# be turned off when serving from networked-mounted 
# filesystems or if support for these functions is otherwise
# broken on your system.
#
#EnableMMAP off
#EnableSendfile off

# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be 
# included to add extra features or to modify the default configuration of 
# the server, or you may simply copy their contents here and change as 
# necessary.

# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf

# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf

# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf

# Language settings
#Include conf/extra/httpd-languages.conf

# User home directories
#Include conf/extra/httpd-userdir.conf

# Real-time info on requests and configuration
#Include conf/extra/httpd-info.conf

# Virtual hosts
#Include conf/extra/httpd-vhosts.conf

# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf

# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf

# Various default settings
#Include conf/extra/httpd-default.conf

# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
#       starting without SSL on platforms with no /dev/random equivalent
#       but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

########################################################
LoadModule weblogic_module modules/lib/mod_wl.so
########################################################
<IfModule mpm_worker_module>
    StartServers            10
    ServerLimit            64
    MaxClients           4096
    MinSpareThreads        100
    MaxSpareThreads      4096
    ThreadsPerChild       64
    MaxRequestsPerChild   40000
</IfModule>

Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
NameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot "/svcroot/runtime/webstatic/Homepage-Backoffice"
    ServerName devwww.test.com.cn
    #    ServerName www.test.com.cn
    ErrorLog "|/app/apache2/bin/rotatelogs /app/logs/webserver/devwww-error_log.%m%d 86400"
    CustomLog "|/app/apache2/bin/rotatelogs /app/logs/webserver/devwww-access_log.%m%d 86400" common
    <IfModule mod_weblogic.c>
        #WebLogicCluster 52.208.110.181:8101,52.208.110.181:8102
        WebLogicHost testch-doap 
        WebLogicPort 8101
        WLCookieName WWWJSESSIONID
        MatchExpression */controller/*
        MatchExpression *.jsp
        MatchExpression *.fo
        MatchExpression */ws/*
        ConnectTimeoutSecs 4
        ConnectRetrySecs 2
        DynamicServerList ON
        Idempotent OFF
        WLIOTimeoutSecs 40
        Debug OFF
#       WLLogFile /tmp/wlproxy_devwww.log
    </IfModule>
    <Directory "/svcroot/runtime/webstatic/Homepage-Backoffice">
        AllowOverride None
        Options FollowSymLinks
   #    Options Indexes MultiViews
        Order deny,allow
        Allow from all
    </Directory>

</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "/svcroot/runtime/webstatic/MobileWAP-Backoffice"
    ServerName devm.test.com.cn
    #    ServerName www.test.com.cn
    ErrorLog "|/app/apache2/bin/rotatelogs /app/logs/webserver/devm-error_log.%m%d 86400"
    CustomLog "|/app/apache2/bin/rotatelogs /app/logs/webserver/devm-access_log.%m%d 86400" common
    <IfModule mod_weblogic.c>
        #WebLogicCluster 52.208.110.181:8101,52.208.110.181:8102
        WebLogicHost testch-doap
        WebLogicPort 8201
        WLCookieName MJSESSIONID
        MatchExpression */controller/*
        MatchExpression *.jsp
        MatchExpression *.fo
        MatchExpression */ws/*
        ConnectTimeoutSecs 4
        ConnectRetrySecs 2
        DynamicServerList ON
        Idempotent OFF
        WLIOTimeoutSecs 40
        Debug OFF
#       WLLogFile /tmp/wlproxy_devm.log
    </IfModule>
    <Directory "/svcroot/runtime/webstatic/MobileWAP-Backoffice">
        AllowOverride None
        Options FollowSymLinks
   #    Options Indexes MultiViews
        Order deny,allow
        Allow from all
    </Directory>

</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "/svcroot/runtime/webstatic/MobileApp-Backoffice"
    ServerName devonapp.test.com.cn
    #    ServerName www.test.com.cn
    ErrorLog "|/app/apache2/bin/rotatelogs /app/logs/webserver/devonapp-error_log.%m%d 86400"
    CustomLog "|/app/apache2/bin/rotatelogs /app/logs/webserver/devonapp-access_log.%m%d 86400" common
    <IfModule mod_weblogic.c>
        #WebLogicCluster 52.208.110.181:8101,52.208.110.181:8102
        WebLogicHost testch-doap
        WebLogicPort 8301
        WLCookieName APPJSESSIONID
        MatchExpression */controller/*
        MatchExpression *.jsp
        MatchExpression *.fo
        MatchExpression */ws/*
        ConnectTimeoutSecs 4
        ConnectRetrySecs 2
        DynamicServerList ON
        Idempotent OFF
        WLIOTimeoutSecs 40
        Debug OFF
#       WLLogFile /tmp/wlproxy_devm.log
    </IfModule>
    <Directory "/svcroot/runtime/webstatic/MobileApp-Backoffice">
        AllowOverride None
        Options FollowSymLinks
   #    Options Indexes MultiViews
        Order deny,allow
        Allow from all
    </Directory>

</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "/svcroot/runtime/webstatic/API-Backoffice"
    ServerName devonapi.test.com.cn
    #    ServerName www.test.com.cn
    ErrorLog "|/app/apache2/bin/rotatelogs /app/logs/webserver/devonapi-error_log.%m%d 86400"
    CustomLog "|/app/apache2/bin/rotatelogs /app/logs/webserver/devonapi-access_log.%m%d 86400" common
    <IfModule mod_weblogic.c>
        #WebLogicCluster 52.208.110.181:8101,52.208.110.181:8102
        WebLogicHost testch-doap
        WebLogicPort 8401
        WLCookieName APIJSESSIONID
        MatchExpression */controller/*
        MatchExpression *.jsp
        MatchExpression *.fo
        MatchExpression */ws/*
        ConnectTimeoutSecs 4
        ConnectRetrySecs 2
        DynamicServerList ON
        Idempotent OFF
        WLIOTimeoutSecs 40
        Debug OFF
#       WLLogFile /tmp/wlproxy_devwww.log
    </IfModule>
    <Directory "/svcroot/runtime/webstatic/API-Backoffice">
        AllowOverride None
        Options FollowSymLinks
   #    Options Indexes MultiViews
        Order deny,allow
        Allow from all
    </Directory>

</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "/svcroot/runtime/webstatic/CMS-Backoffice"
    ServerName devonadm.test.com.cn
    #    ServerName www.test.com.cn
    ErrorLog "|/app/apache2/bin/rotatelogs /app/logs/webserver/devonadm-error_log.%m%d 86400"
    CustomLog "|/app/apache2/bin/rotatelogs /app/logs/webserver/devonadm-access_log.%m%d 86400" common
    <IfModule mod_weblogic.c>
        #WebLogicCluster 52.208.110.181:8101,52.208.110.181:8102
        WebLogicHost testch-doap
        WebLogicPort 8501
        WLCookieName ADMJSESSIONID
        MatchExpression */controller/*
        MatchExpression *.svl
        MatchExpression *.jsp
        MatchExpression *.fo
        MatchExpression */ws/*
        ConnectTimeoutSecs 4
        ConnectRetrySecs 2
        DynamicServerList ON
        Idempotent OFF
        WLIOTimeoutSecs 40
        Debug OFF
#       WLLogFile /tmp/wlproxy_devwww.log
    </IfModule>
    <Directory "/svcroot/runtime/webstatic/CMS-Backoffice">
        AllowOverride None
        Options FollowSymLinks
   #    Options Indexes MultiViews
        Order deny,allow
        Allow from all
    </Directory>

</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "/svcrootStg/runtime/webstatic/Homepage-Backoffice"
    ServerName stgwww.test.com.cn
    #    ServerName www.test.com.cn
    ErrorLog "|/app/apache2/bin/rotatelogs /app/logs/webserver/stgwww-error_log.%m%d 86400"
    CustomLog "|/app/apache2/bin/rotatelogs /app/logs/webserver/stgwww-access_log.%m%d 86400" common
    <IfModule mod_weblogic.c>
        #WebLogicCluster 52.208.110.181:8101,52.208.110.181:8102
        WebLogicHost testch-doap
        WebLogicPort 8111
        WLCookieName WWWJSESSIONID
        MatchExpression */controller/*
        MatchExpression *.jsp
        MatchExpression *.fo
        MatchExpression */ws/*
        ConnectTimeoutSecs 4
        ConnectRetrySecs 2
        DynamicServerList ON
        Idempotent OFF
        WLIOTimeoutSecs 40
        Debug OFF
#       WLLogFile /tmp/wlproxy_stgwww.log
    </IfModule>
    <Directory "/svcrootStg/runtime/webstatic/Homepage-Backoffice">
        AllowOverride None
        Options FollowSymLinks
   #    Options Indexes MultiViews
        Order deny,allow
        Allow from all
    </Directory>

</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "/svcrootStg/runtime/webstatic/MobileWAP-Backoffice"
    ServerName stgm.test.com.cn
    #    ServerName www.test.com.cn
    ErrorLog "|/app/apache2/bin/rotatelogs /app/logs/webserver/stgm-error_log.%m%d 86400"
    CustomLog "|/app/apache2/bin/rotatelogs /app/logs/webserver/stgm-access_log.%m%d 86400" common
    <IfModule mod_weblogic.c>
        #WebLogicCluster 52.208.110.181:8101,52.208.110.181:8102
        WebLogicHost testch-doap
        WebLogicPort 8211
        WLCookieName MJSESSIONID
        MatchExpression */controller/*
        MatchExpression *.jsp
        MatchExpression *.fo
        MatchExpression */ws/*
        ConnectTimeoutSecs 4
        ConnectRetrySecs 2
        DynamicServerList ON
        Idempotent OFF
        WLIOTimeoutSecs 40
        Debug OFF
#       WLLogFile /tmp/wlproxy_stgm.log
    </IfModule>
    <Directory "/svcrootStg/runtime/webstatic/MobileWAP-Backoffice">
        AllowOverride None
        Options FollowSymLinks
   #    Options Indexes MultiViews
        Order deny,allow
        Allow from all
    </Directory>

</VirtualHost>


<VirtualHost *:80>
    DocumentRoot "/svcrootStg/runtime/webstatic/MobileApp-Backoffice"
    ServerName stgonapp.test.com.cn
    #    ServerName www.test.com.cn
    ErrorLog "|/app/apache2/bin/rotatelogs /app/logs/webserver/stgonapp-error_log.%m%d 86400"
    CustomLog "|/app/apache2/bin/rotatelogs /app/logs/webserver/stgonapp-access_log.%m%d 86400" common
    <IfModule mod_weblogic.c>
        #WebLogicCluster 52.208.110.181:8101,52.208.110.181:8102
        WebLogicHost testch-doap
        WebLogicPort 8311
        WLCookieName APPJSESSIONID
        MatchExpression */controller/*
        MatchExpression *.jsp
        MatchExpression *.fo
        MatchExpression */ws/*
        ConnectTimeoutSecs 4
        ConnectRetrySecs 2
        DynamicServerList ON
        Idempotent OFF
        WLIOTimeoutSecs 40
        Debug OFF
#       WLLogFile /tmp/wlproxy_stgm.log
    </IfModule>
    <Directory "/svcrootStg/runtime/webstatic/MobileApp-Backoffice">
        AllowOverride None
        Options FollowSymLinks
#    Options Indexes MultiViews
Order deny,allow
Allow from all
</Directory>

</VirtualHost>


<VirtualHost *:80>
DocumentRoot "/svcrootStg/runtime/webstatic/API-Backoffice"
    ServerName stgonapi.test.com.cn
    #    ServerName www.test.com.cn
    ErrorLog "|/app/apache2/bin/rotatelogs /app/logs/webserver/stgonapi-error_log.%m%d 86400"
    CustomLog "|/app/apache2/bin/rotatelogs /app/logs/webserver/stgonapi-access_log.%m%d 86400" common
    <IfModule mod_weblogic.c>
        #WebLogicCluster 52.208.110.181:8101,52.208.110.181:8102
        WebLogicHost testch-doap
        WebLogicPort 8411
        WLCookieName APIJSESSIONID
        MatchExpression */controller/*
        MatchExpression *.jsp
        MatchExpression *.fo
        MatchExpression */ws/*
        ConnectTimeoutSecs 4
        ConnectRetrySecs 2
        DynamicServerList ON
        Idempotent OFF
        WLIOTimeoutSecs 40
        Debug OFF
#       WLLogFile /tmp/wlproxy_stgwww.log
    </IfModule>
    <Directory "/svcrootStg/runtime/webstatic/API-Backoffice">
        AllowOverride None
        Options FollowSymLinks
   #    Options Indexes MultiViews
        Order deny,allow
        Allow from all
    </Directory>

</VirtualHost>


<VirtualHost *:80>
    DocumentRoot "/svcrootStg/runtime/webstatic/CMS-Backoffice"
    ServerName stgonadm.test.com.cn
    #    ServerName www.test.com.cn
    ErrorLog "|/app/apache2/bin/rotatelogs /app/logs/webserver/stgonadm-error_log.%m%d 86400"
    CustomLog "|/app/apache2/bin/rotatelogs /app/logs/webserver/stgonadm-access_log.%m%d 86400" common
    <IfModule mod_weblogic.c>
        #WebLogicCluster 52.208.110.181:8101,52.208.110.181:8102
        WebLogicHost testch-doap
        WebLogicPort 8511
        WLCookieName ADMJSESSIONID
        MatchExpression */controller/*
        MatchExpression *.svl
        MatchExpression *.jsp
        MatchExpression *.fo
        MatchExpression */ws/*
        ConnectTimeoutSecs 4
        ConnectRetrySecs 2
        DynamicServerList ON
        Idempotent OFF
        WLIOTimeoutSecs 40
        Debug OFF
#       WLLogFile /tmp/wlproxy_stgwww.log
    </IfModule>
    <Directory "/svcrootStg/runtime/webstatic/CMS-Backoffice">
        AllowOverride None
        Options FollowSymLinks
   #    Options Indexes MultiViews
        Order deny,allow
        Allow from all
    </Directory>

</VirtualHost>

4、weblogic附表

附表-插件的通用参数(大小写区分)

参数

默认值

描述

WebLogicHost

(如果代理到单个WebLogic服务器,那么应该设置该参数)

none

HTTP请求被递交到该WebLogic Server主机(或者是定义在WebLogic Server中运行的类似于Web server的虚拟主机名)如果使用集群,那么应该使用WebLogicCluster参数而不是WebLogicHost参数。

WebLogicPort

(如果代理到单个WebLogic服务器,那么应该设置该参数)

none

WebLogic服务器监听WebLogic连接请求的端口。(如果在插件与WebLogic服务器之间使用SSL,那么应该把该参数设置为SSL监听端口(见8-4页的"配置监听端口")并将SecureProxy参数设置为ON)。

如果使用WebLogic集群,那么应该设置WebLogicCluster参数而不是WebLogicPort参数。

WebLogicCluster

(如果代理到一个WebLogic服务器集群,那么必须设置该参数)

none

集群中的WebLogic服务器列表,用于负载平衡目的。该列表由逗号分隔开的host:port组成。例如:

WebLogicCluster myweblogic.com:7001,

yourweblogic.com:7001,theirweblogic.com:7001

如果插件与WebLogic服务器之间使用SSL协议,那么将端口号设置为SSL监听端口(见8-3页的"配置监听端口")并将SecureProxy参数设置为ON。

应该用该参数取代WebLogicHost与WebLogicPort参数,WebLogic Server首先查找WebLogicCluster参数,如果没有找到该参数,它将寻找并使用WebLogicHost与WebLogicPort参数。

插件对所有可用的集群成员进行轮询。该参数所指定的集群列表是服务器与插件共同维护的动态列表的初始值。WebLogic服务器与插件将根据新加入的、失败的以及恢复的集群成员的情况动态地更新集群列表。

如果将 DynamicServerList参数设置为OFF(只适用于Microsoft Internet Information Server),那么集群列表的动态更新被禁用。插件将请求导向集群中最初创建cookie的那个服务器上(请求包含cookie、URL- encoded会话或存于POST数据中的会话信息)。

PathTrim

none

在请求被转交到WebLogic服务器之前,被插件从原始URL中裁剪掉的字符串。例如:如果原始URL为

http://myWeb.server.com /weblogic/foo被传递到插件进行解析且PathTrim参数被设置为/weblogic,那么传递到WebLogic服务器的URL变 为:http://myweblogic.server.com:7001/foo

PathPrepend

null

加在原始URL前的前缀字符串,该动作发生在PathTrim被裁剪后,请求转向WebLogic服务器之前。

ConnectTimeoutSecs

10

插件进行WebLogic服务器主机连接尝试的时间上限。该值应该大于 ConnectRetrySecs参数。如果超过ConnectTimeoutSecs还没能连接成功,即使进行了适当次数的连接重试(见 ConnectRetrySecs参数),也将把HTTP 503/Service Unavailable响应返回给客户端。

可以使用ErrorPage参数定制错误响应。

ConnectRetrySecs

2

该参数以秒为单位,设置了两次WebLogic Server主机(或集群中的所有服务器)连接尝试之间,插件的休眠时间。该参数的值应该小于ConnectTimeoutSecs。插件在返回HTTP 503/Service Unavailable响应之前,它将进行的连接次数为ConnectTimeoutSecs除以ConnectRetrySecs所得的值。

如果不希望重试连接,那么应该将ConnectRetrySecs值应该与ConnectTimeoutSecs相等。不过,插件会至少进行两次连接尝试。

可以用ErrorPage参数定制错误响应。

Debug

OFF

设置调试操作时的日志类型。在生产系统中不建议你开启这些调试选项。

在UNIX系统中,调试信息被写到 /tmp/wlproxy.log文件中;在Windows NT系统,调试信息被写到c:/temp/wlproxy.log文件中,通过WLLogFile参数,你可以使用其他路径下的其他文件覆盖文件名、路径 参数。你可以设置以下日志选项(其中HFC, HTW, HFW, HTC可以联合使用,它们之间用逗号隔开,如"HFC, HTW");

ON

  插件只记录报告性消息与错误消息

OFF

  不记录调试信息

HFC

  记录来自客户端消息、报告性消息以及错误消息的消息头。

HTW

  记录从weblogic发送来的消息头,报告性消息与错误消息

HFW

  记录来自weblogic服务器消息的消息头,报告性消息与错误消息

HTC

  记录发送到客户端消息的消息头,报告性消息与错误消息

ALL

  记录发送到客户端以及客户端发送的消息的头,发送到WebLogic服务器以及WebLogic服务器发送的消息头,报告性消息,错误消息

WLLogFile

参见Debug参数

指明当Debug参数为ON时,产生日志文件的路径和文件名,在设置该参数前,必须创建相应目录。

DebugConfigInfo

OFF

启用特殊查询参数"_WebLogicBridgeConfig"。该参数可以被用来了解插件的配置参数的细节。

例如,如果把 DebugConfigInfo设置为ON,那么"_WebLogicBridgeConfig"被启用。发送一个包含查询字符 串?_WebLogicBridgeConfig的请求,插件将收集配置信息有运行时的统计信息并将这些信息返回给浏览器。在处理该请求时,插件没有连接 到WebLogic服务器。

该参数只应严格用于调试目的。消息的输出格式随版本的变化而不同。为了安全起见,在生产环境中应该将该参数设置为OFF。

StatPath(Microsoft Internet Information Server 插件没有这个参数。)

false

如果把该参数设置为真,插件在把请求传递到WebLogic服务器之前检查被转换的路径是 否存在或及其访问权限("Proxy-Path-Translated")。如果文件不存在,将把HTTP 404 File Not Found响应返回给客户端。如果文件存在,但它的权限不是world-readable,那么将返回HTTP 403/Forbidden响应。这两种情况下Web服务器处理这些响应的缺省机制是执行响应的体内容。如果WebLogic服务器的Web应用与Web 服务器具有相同的文档根,那么该选项非常有用。

可以使用ErrorPage参数定制错误响应。

ErrorPage

none

可以制作自己的错误响应页面,在Web服务器不能将请求代理到WebLogic服务器时使用。

设置该参数的方式有两种:

  • 作为相对URI(文件名)。插件自动将返回错误的Web应用的上下文路径加到URI中。对错误页面的请求是否回代理到WebLogic服务器取决于你对代理的配置(是MIME类型式代理还是路径式代理)。
  • 作为绝对URI(建议)。使用错误页面的绝对路径能够使请求总是被代理到WebLogic服务器中的正确资源上。例如: http://host:port/myWebApp/ErrorPage.html

HungServerRecoverSecs

300

定义了插件等待WebLogic服务器响应请求的时间。在等待了 HungServerRecoverSecs时间后,插件还没有得到服务器的响应,那么它将宣布该服务器已经死机并失败转移到下一个服务器。应该把该参数 设置为一个较大的值。如果所设置的值小于servlets进行处理的时间,那么会得到意想不到的后果。

最小值为:10

最大值为:600

Idempotent

ON

如果该参数设置为ON,那么当服务器在指定的HungServerRecoverSecs 时间没有响应,那么插件将进行容错处理。如果设置为OFF,插件将不进行失败转移。如果所使用的是Netscape Enterprise Server插件或Apache HTTP Server插件,不同的URL与MIME类型可以有不同的Idempotent参数设置。

CookieName

JSESSIO

NID

如果改变了WebLogic服务器Web应用中的WebLogic服务器会话cookie 的名字,那么相应地应该将插件的CookieName参数设置为相同的值。WebLogic会话cookie的名字在特定于WebLogic的分发描述符 的<session-descriptor>元素中定义

DefaultFileName

none

如果URI为"/",插件将执行以下步骤:

1.裁剪掉PathTrim参数所指定的路径

2.在后面加上DefaultFileName所指定的文件名

3.在前面加上 PathPrepend参数所指定的值这样处理可以防止WebLogic服务器的重定向。将DefaultFileName设置为代理WebLogic服 务器的Web应用的缺省欢迎页面。例如,如果DefaultFileName被设置为welcome.html,那么下面这个HTTP请求:

http://somehost/weblogic

变为:http://somehost/weblogic/welcome.html。只有当所有被重定向的web应用指定相同的欢迎页面, 该参数才起作用。可以参见以下页面的"Configuring Welcome Pages"部分:

http://e-docs.bea.com/wls/docs61/webapp/components

对于Apache用户,所使用的是Stronghold或Raven的版本,在Location块中定义参数,而非IfModule块中

MaxPostSize

-1

POST数据的允许的最大长度。如果内容的长度超过MaxPostSize,插件将返回一个错误消息。如果设置为-1,将不检查POST数据的长度。设置该参数可以防止通过发送大量数据使服务器过载的"拒绝服务攻击"。

MatchExpression

(该参数只适用于Apache HTTP服务器)

none

如果采用MIME类型方式代理,应该在一个IfModule块中使用MatchExpression参数设置文件名模式。

下面的一个例子说明了使用MIME类型方式的代理:

<IfModule mod_weblogic.c>

MatchExpression *.jsp

WebLogicHost=myHost|paramName=value

</IfModule>

下面的一个例子说明了使用路径方式的代理:

<IfModule mod_weblogic.c>

MatchExpression /weblogicWebLogicHost=myHost|paramName=value

</IfModule>

FileCaching

ON

当该参数设置为ON,如果请求中的POST数据大于2084个字节,那么POST数据保存 在硬盘的一个临时文件中,然后以8192字节为单位传给WebLogic服务器。但将FileCaching设置为ON,可能引起的问题是浏览器上将显示 一个进展条表明正在进行下载。即使文件还在传输,浏览器也会显示下在已经完成。

如果该参数设置为OFF,那么当 POST数据大于2084字节时,数据保存在内存中并以8192字节为单位发送到WebLogic服务器。将参数设置为OFF可能会引起问题。因为插件不 能进行失败转移,因此如果请求被处理时WebLogic 服务器宕机了,那么数据将被丢失。

WlForwardPath

(只有Microsoft IIS才需要定义该单数)

null

如果WLForwardPath设置为"/",那么所有请求都被代理到WebLogic服 务器。如果只想代理以特定字符串开头的请求,那么应该将WlForwardPath参数设置为这个字符串。例如,将WlForwardPath设置为 /webogic,那么所有以/weblogic开始的请求都将被代理到WebLogic服务器。

如果采用路径方式的代理,那么必须设置该参数。可以为该参数设置多个字符串,字符串之间用逗号隔开,例如:WlForwardPath=/weblogic,/bea。

KeepAliveSecs

(不要为Apache HTTP服务器版本1.3.x定义该参数)

30

该参数定义了隔多长时间后,插件与WebLogic服务器之间的非活动连接将被关闭。要使该参数生效,KeepAliveEnabled参数应该设置为true。

该参数的值应该小于或等于在管理控制台的Server/HTTP标签页中Duration字段的值,或者是服务器Mbean中的keepAliveSecs属性的值。

KeepAliveEnabled

True

启用插件与WebLogic服务器之间的连接池。

QueryFromRequest

(只适用于Apache HTTP服务器)

OFF

如果该参数设置为ON,那么Apache插件使用(request_rec *)r->the request将查询字符串传递到WebLogic服务器。(详细信息,请参见Apache文档。)这种行为在以下场合非常有用:

当Netscape 版本4.x浏览器发出的请求的查询字符串中包含空格。

如果你在HP上使用Raven Apache 1.5.2

如果该参数设置为OFF,那么Apache插件使用(request_rec *)r->args将查询字符串传递到WebLogic服务器。

MaxSkips

(在Apache 1.3 中不可用)

10

只有当DynamicServerList设置为OFF时,该参数的设置才生效。如果 WebLogicCluster参数所设置的列表或由WebLogic服务器返回的动态集群列表中的WebLogic服务器失败了,那么该失败的服务器被 标记为"坏的",同时插件将连接到列表中的下一个服务器中。

MaxSkip设置了插件重试"坏"服务器的次数。每当插件接收到一个唯一请求(即不包含cookie的请求)时,它会连接到列表中的一个新服务器上

DynamicServerList

(只能在Microsfot IIS中设置该参数)

ON

如果该参数设置为OFF,在对由插件所代理的请求进行负载平衡时,不使用动态集群列表,而是使用WebLogicCluster参数指定的静态列表。通常情况下,该参数应该设置为ON。将该参数设置为ON,可能会产生以下影响:

  • 如果静态列表中的一或多个服务器失败了,那么插件可能会因为重试连接到失效服务器而导致性能的降低。
  • 当你在集群中新增了一个服务器,如果不重新定义这个参数,插件就不能将请求代理到这个新服务器上。WebLogic服务器会自动地将新服务器加到动态服务器列表,从而使新服务器成为集群的一部分。




----------------------------------

(完)





上一篇:听说你的监控不理想?这5个特征具备了么


下一篇:凯迪生态携手海通安恒,成功启动SAP实施项目