1. 程式人生 > >apache 和 一個 tomcat 整合 測試成功 案例 程式碼

apache 和 一個 tomcat 整合 測試成功 案例 程式碼

apache   /conf/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 "logs/foo.log"
# with ServerRoot set to "E:/Apache Software Foundation/Apache2.2" will be interpreted by the
# server as "E:/Apache Software Foundation/Apache2.2/logs/foo.log".
#
# NOTE: Where filenames are specified, you must use forward slashes
# instead of backslashes (e.g., "c:/apache" instead of "c:\apache").
# If a drive letter is omitted, the drive on which Apache.exe is located
# will be used by default.  It is recommended that you always supply
# an explicit drive letter in absolute paths, however, to avoid
# confusion.
#

# ThreadsPerChild: constant number of worker threads in the server process
# MaxRequestsPerChild: maximum  number of requests a server process serves
ThreadsPerChild 250
MaxRequestsPerChild  0

#
# 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 "E:/Apache Software Foundation/Apache2.2"

#
# 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 (0.0.0.0)
#
#Listen 12.34.56.78:80
Listen 80
#Listen 8888

#
# 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
#
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
#LoadModule auth_digest_module modules/mod_auth_digest.so
#LoadModule authn_anon_module modules/mod_authn_anon.so
#LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authn_file_module modules/mod_authn_file.so
#LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
#LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule cgi_module modules/mod_cgi.so
#LoadModule dav_module modules/mod_dav.so
#LoadModule dav_fs_module modules/mod_dav_fs.so
#LoadModule deflate_module modules/mod_deflate.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
#LoadModule expires_module modules/mod_expires.so
#LoadModule file_cache_module modules/mod_file_cache.so
#LoadModule headers_module modules/mod_headers.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule include_module modules/mod_include.so
#LoadModule info_module modules/mod_info.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
#LoadModule mime_magic_module modules/mod_mime_magic.so

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

#修改內容如下:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
#LoadModule slotmem_shm_module modules/mod_slotmem_shm.so

LoadModule negotiation_module modules/mod_negotiation.so
#LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
#LoadModule speling_module modules/mod_speling.so
#LoadModule status_module modules/mod_status.so
#LoadModule unique_id_module modules/mod_unique_id.so
LoadModule userdir_module modules/mod_userdir.so
#LoadModule usertrack_module modules/mod_usertrack.so
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
#LoadModule ssl_module modules/mod_ssl.so

# '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. [email protected]
#
ServerAdmin [email protected]

#
# 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 localhost: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 "E:/Apache Software Foundation/Apache2.2/htdocs"

#改動的內容如下:
DocumentRoot "E:/apache-tomcat-7.0.72-2/webapps/AppServlet"

#
# 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
    Satisfy 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 "E:/apache-tomcat-7.0.72-2/webapps/AppServlet">


#<Directory "E:/Apache Software Foundation/Apache2.2/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

###  此行程式碼正確 ,取消目錄了 Options  FollowSymLinks
Options -Indexes FollowSymLinks

#改成如下:
#<Directory />
 #   Options Indexes FollowSymLinks
#    AllowOverride None
   
#  </Directory>


    #
    # 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
#改成如下:
    DirectoryIndex testlb.jsp
</IfModule>

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<FilesMatch "^\.ht">
    Order allow,deny
    Deny from 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://localhost/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/ "E:/Apache Software Foundation/Apache2.2/cgi-bin/"

</IfModule>

#
# "E:/Apache Software Foundation/Apache2.2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "E:/Apache Software Foundation/Apache2.2/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

#
# Apache parses all CGI scripts for the shebang line by default.
# This comment line, the first line of the script, consists of the symbols
# pound (#) and exclamation (!) followed by the path of the program that
# can execute this specific script.  For a perl script, with perl.exe in
# the C:\Program Files\Perl directory, the shebang line should be:

   #!c:/program files/perl/perl

# Note you _must_not_ indent the actual shebang line, and it must be the
# first line of the file.  Of course, CGI processing must be enabled by
# the appropriate ScriptAlias or Options ExecCGI directives for the files
# or directory in question.
#
# However, Apache on Windows allows either the Unix behavior above, or can
# use the Registry to match files by extention.  The command to execute
# a file of this type is retrieved from the registry by the same method as
# the Windows Explorer would use to handle double-clicking on a file.
# These script actions can be configured from the Windows Explorer View menu,
# 'Folder Options', and reviewing the 'File Types' tab.  Clicking the Edit
# button allows you to modify the Actions, of which Apache 1.3 attempts to
# perform the 'Open' Action, and failing that it will try the shebang line.
# This behavior is subject to change in Apache release 2.0.
#
# Each mechanism has it's own specific security weaknesses, from the means
# to run a program you didn't intend the website owner to invoke, and the
# best method is a matter of great debate.
#
# To enable the this Windows specific behavior (and therefore -disable- the
# equivilant Unix behavior), uncomment the following directive:
#
#ScriptInterpreterSource registry
#
# The directive above can be placed in individual <Directory> blocks or the
# .htaccess file, with either the 'registry' (Windows behavior) or 'script'
# (Unix behavior) option, and will override this server default option.
#

#
# 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://localhost/subscription_info.html
#

#
# 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
#修改的內容:
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>


#新增的內容如下:
Include conf/mod_jk.conf

#SetEnv force-proxy-request-1.0.1
#SetEnv proxy-nokeepalive 1

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

/conf/mod_jk.conf

# Load mod_jk2 module

LoadModule jk_module modules/mod_jk-1.2.31-httpd-2.2.3.so

# Where to find workers.properties( 引用 workers 配置檔案 )

JkWorkersFile conf/workers.properties

# Where to put jk logs(log 檔案路徑 )

JkLogFile logs/mod_jk2.log

# Set the jk log level [debug/error/info](log 級別 )

JkLogLevel info

# Select the log format(log 格式 )

JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

# JkOptions indicate to send SSL KEY SIZE,

JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories

# JkRequestLogFormat set the request format

JkRequestLogFormat "%w %V %T"

# Send JSPs for context / to worker named loadBalancer(URL 轉發配置,匹配的 URL
#才轉發到 tomcat 進行處理 )

#可能要新增  DocumentRoot "E:/Apache Software Foundation/Apache2.2/htdocs "


JkMount /*.jsp   tomcat2

 JkMount /*.*    tomcat2

JkMount /servlet/*    tomcat2

#關掉主機Lookup,如果為on,很影響效能,可以有10多秒鐘的延遲。
HostnameLookups Off

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

/conf/workers.properties 

# 為mod_jk模組指明JDK的安裝路徑
workers.java_home=C:/Program Files/Java/jdk1.8.0_91

#新增路徑了:
workers.tomcat_home=E:/apache-tomcat-7.0.72-2

#server  
worker.list = tomcat2
#========tomcat1========  
#worker.tomcat1.port=8080 
#worker.tomcat1.host=localhost  
#worker.tomcat1.type=ajp13  
#worker.tomcat1.lbfactor = 1 

#========tomcat2========
#workers.tomcat_home=C:\Tomcat-6.0.29 #讓mod_jk模組知道Tomcat的位置  
#workers.java_home=C:\Java\jdk1.6.0_10\jre #讓mod_jk模組知道jre的位置  
 
worker.tomcat2.port=8188 
worker.tomcat2.host=localhost  
worker.tomcat2.type=ajp13  
worker.tomcat2.lbfactor = 1 

#========controller,負載均衡控制器========  
worker.controller.type=lb  
worker.controller.balanced_workers=tomcat1,tomcat2
worker.controller.sticky_session=false 
worker.controller.sticky_session_force=1 
#worker.controller.sticky_session=1 

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

/conf/extra/httpd-vhosts.conf 

#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
#<VirtualHost *:80>
#    ServerAdmin [email protected]
 #   DocumentRoot /www/docs/dummy-host.localhost
#    ServerName dummy-host.localhost
#    ServerAlias www.dummy-host.localhost
 #   ErrorLog logs/dummy-host.localhost-error_log
 #   CustomLog logs/dummy-host.localhost-access_log common
#</VirtualHost>

#<VirtualHost *:80>
 #   ServerAdmin [email protected]
 #   DocumentRoot /www/docs/dummy-host2.localhost
 #   ServerName dummy-host2.localhost
 #   ErrorLog logs/dummy-host2.localhost-error_log
 #   CustomLog logs/dummy-host2.localhost-access_log common
#</VirtualHost>

#修改的內容如下:
<VirtualHost *:80>
    ServerName localhost
    ServerAlias   localhost:80
    DocumentRoot E:/apache-tomcat-7.0.72-2/webapps/AppServlet
</VirtualHost>

<VirtualHost *:80>
    ServerName localhost
    ServerAlias localhost
   # ProxyPass / http://localhost:8888/
   # ProxyPassReverse / http://localhost:8888/

 #  JkMount /*.action ajp13

    JkMount /*.action tomcat2
JkMount /*.jsp   tomcat2

 JkMount /*.*    tomcat2
</VirtualHost>

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

 E:\Apache Software Foundation\Apache2.2\modules                       mod_jk-1.2.31-httpd-2.2.3.so

========================================================================================

tomcat2

server.xml 程式碼:

<?xml version='1.0' encoding='utf-8'?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- Note:  A "Server" is not itself a "Container", so you may not
     define subcomponents such as "Valves" at this level.
     Documentation at /docs/config/server.html
 -->
<Server port="8006" shutdown="SHUTDOWN">
  <Listener className="org.apache.catalina.startup.VersionLoggerListener" />
  <!-- Security listener. Documentation at /docs/config/listeners.html
  <Listener className="org.apache.catalina.security.SecurityListener" />
  -->
  <!--APR library loader. Documentation at /docs/apr.html -->
  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
  <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
  <Listener className="org.apache.catalina.core.JasperListener" />
  <!-- Prevent memory leaks due to use of particular java/javax APIs-->
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

  <!-- Global JNDI resources
       Documentation at /docs/jndi-resources-howto.html
  -->
  <GlobalNamingResources>
    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>

  <!-- A "Service" is a collection of one or more "Connectors" that share
       a single "Container" Note:  A "Service" is not itself a "Container",
       so you may not define subcomponents such as "Valves" at this level.
       Documentation at /docs/config/service.html
   -->
  <Service name="Catalina">

    <!--The connectors can use a shared executor, you can define one or more named thread pools-->
    <!--
    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
        maxThreads="150" minSpareThreads="4"/>
    -->


    <!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned. Documentation at :
         Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL HTTP/1.1 Connector on port 8080
    -->
    <Connector port="8888" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    <!-- A "Connector" using the shared thread pool-->
    <!--
    <Connector executor="tomcatThreadPool"
               port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    -->
    <!-- Define a SSL HTTP/1.1 Connector on port 8443
         This connector uses the BIO implementation that requires the JSSE
         style configuration. When using the APR/native implementation, the
         OpenSSL style configuration is required as described in the APR/native
         documentation -->
    <!--
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
               maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" />
    -->

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8188" protocol="AJP/1.3" redirectPort="8443" />


    <!-- An Engine represents the entry point (within Catalina) that processes
         every request.  The Engine implementation for Tomcat stand alone
         analyzes the HTTP headers included with the request, and passes them
         on to the appropriate Host (virtual host).
         Documentation at /docs/config/engine.html -->

    <!-- You should set jvmRoute to support load-balancing via AJP ie :
    <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
    -->
    <Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat2">

      <!--For clustering, please take a look at documentation at:
          /docs/cluster-howto.html  (simple how to)
          /docs/config/cluster.html (reference documentation) -->
      <!--
      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
      -->
      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>

      <!-- Use the LockOutRealm to prevent attempts to guess user passwords
           via a brute-force attack -->
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <!-- This Realm uses the UserDatabase configured in the global JNDI
             resources under the key "UserDatabase".  Any edits
             that are performed against this UserDatabase are immediately
             available for use by the Realm.  -->
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase"/>
      </Realm>

      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">

        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log." suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b" />

      </Host>
    </Engine>
  </Service>
</Server>

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

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

相關推薦

apache 一個 tomcat 整合 測試成功 案例 程式碼

apache   /conf/httpd.conf # # This is the main Apache HTTP server configuration file.  It contains the # configuration directives that g

光纖存儲重組raid磁盤陣列raid數據恢復成功案例

存儲設備 提取數據 成功 過程 壞道 nag 客戶 進行 無法 今天我給大家分享的是一篇關於raid磁盤陣列數據恢復的案例,本案例中包含了對磁盤陣列的修復和重組過程,raid數據恢復中的方法比較通用,希望在數據恢復方面對大家有所幫助。 Raid陣列情況介紹: 需要進行數據恢

Windows下 Apache Http Server+ Tomcat 整合配置

可能網上已經有很多教程,這裡只是記錄OneCoder自己的搭建過程。 解壓後放置到apache安裝目錄中的modules資料夾中。 然後修改httpd.conf中的配置。加入配置: LoadModule jk_module modul

Springredis的整合測試

1.專案匯入spring_test和junit包.(使用maven直接在pom檔案中新增). <dependency> <groupId>junit</grou

linux下apache+mod_jk.so+tomcat整合(基礎版)

本文所實現的目的是實現動靜分離的負載均衡 安裝前的準備 CentOS 7 最小化安裝 yum 安裝 gcc  gcc-c++ perl apache-tomcat-9.0.0.M4.tar.gz           //tomcat二進位制壓縮包(不是原始碼包) apr-1

ApacheTomcat整合一個Apache 不同域名處理多個不同業務)

一、簡介在專案中,幾乎任何一個專案都包括靜態資源和動態請求兩大部分。特別對於入口網站這樣的專案,靜態內容資源會更多,我們使用一般的 Tomcat 部署時,Tomcat 對靜態資源的處理能力比較慢,至少比 Apache 要慢很多。為了提高專案的訪問速度,降低伺服器負載提高效能,

Linux下Apache Httpdtomcat整合

最近學習apache+tomcat將網路上、書上和API上看到進行了一下整理,做了個小測試,算做入門學習總結吧,具體內容如下: 1、準備 下載需要的檔案。這裡假定你已經正確安裝配置好了JDK。 例如:chmod 777 jdk-6u37-linux-i586.bin ./j

Ubuntu整合ApacheTomcat

前兩篇已經寫了Apache和Tomcat的安裝,本文主要探討Apache和Tomcat的整合。 〇、為什麼要整合 Tomcat也有webserver的功能,但一般只用作除錯,其強項還是在於處理動態網頁,靜態網頁不如Apache這種專業的webserver。 一、整合是什

用jk整合Apachetomcat實現負載均衡

最近剛看完一些關於如何用jk整合Apache和tomcat的資料,為了防止自己忘記,把它們在這裡都寫下來。部分內容摘抄於網路。 首先下載tomcat, apache和jk。 1. 下載, 安裝於“C:/Program Files/Apache Software Foundat

配置了APACHETOMCAT整合後,firefox中的window.parent.document不能用(http_proxy的埠問題)

    我在linux上使用http_proxy的方式配置了apache跟tomcat的負載均衡,後來發現在firefox中window.parent.document.getElementById("menu").src="content/contentNav.jsp";沒

apachetomcat有什麼不同,為什麼要整合apache tomcat

轉自:[url]http://zhidao.baidu.com/question/94817329.html[/url]1. Apache是web伺服器,Tomcat是應用(java)伺服器,它只是一個servlet容器,是Apache的擴充套件。2. Apache和Tomc

整合整合ApacheTomcat

Apache是web伺服器,Tomcat是應用(java)伺服器,它只是一個servlet容器,是Apache的擴充套件。 Apache和Tomcat都可以做為獨立的web伺服器來執行,但是Apache不能解釋java程式(jsp,serverlet)。 Apache和T

成為一個優秀的測試工程師需要具備哪些知識經驗?

重構 集成 常常 頁面 匹配 archive 靜態代碼檢查工具 作用 安全測試 根據我的觀察,優秀的測試人員可以做的事情可以包括如下3點: 由單純的測試變成項目質量保證工作持續集成探索和推動和自動化測試技術研究測試相關工具的開發1、我們先來講第一點,由單純的測試變成項目質量

ApacheTomcat整合的配置

str windows nec x86 logs info ogr 級別 oca 下載jk連接器地址:http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/windows/ 把jk連接器即“m

Swagger2springMVC整合測試

inter encoding src mybatis project constrain aop servle efault 對Swagger寫個獨立的工程測試,方便後續進行工程的整合,這裏做一下記錄 1.pom.xml--依賴的的包 1 <project xm

C.整合apachePHP的詳細步驟

詳細 地址欄 技術分享 報錯 文件 所在 服務器 打開 ica apache和php都配置後,只是能單獨運行,要聯合起來工作,還要進行相應的配置,否則無法通過瀏覽器訪問.php文件(帶有php代碼)一,讓apache服務器加載“PHP模塊” 打開apache的

apache tomcat 整合

unix include ora shared -- rac 加載 web 連接器 1、編譯安裝apache 下載: 官網 http://httpd.apache.org/docs/2.4/install.htmlwget http://ftp.twaren.net/

服務器Raid數據恢復成功案例raid 5數據恢復算法原理

服務器數據恢復 raid數據恢復 磁盤陣列數據恢復 北亞數據恢復中心 服務器Raid 5數據恢復案例本次分享的案例是一臺服務器中的raid磁盤陣列,磁盤陣列中有12塊磁盤,單盤容量500G,ext3文件系統,系統平臺為Linux平臺。Raid中2號盤和6號盤兩塊硬盤報黃燈,管理人員檢查後對6號

一個成功案例讓你看懂智能養卡代還系統

模式 size 分享 特性 pro alt 自己的 src 代理 隨著三級分銷的商業模式發展以來,越來越受到大家的歡迎,不斷有新的商家加入其中。而三級分銷的支付系統自開發以來也為企業創造了很多價值,那麽三級分銷支付系統到底是怎麽一回事呢?零零壹的小編給你詳細說說吧。一個故事

Jmeter+Maven+jenkins介面效能可持續整合測試

話說無時無刻都覺得有很多東西需要學習,但是我所奉行的理念的就是每天都進步一點,不斷完善不斷提高!!!!話不多說,進入正題:其實在本文最重要的應該就是jmeter的指令碼和pom.xml檔案 一、首先當然是在Jmeter的工具裡面編寫好自己的指令碼,除錯執行成功。本文就以專案測試中的兩個