`

apache web server 与tomcat 绑定

    博客分类:
  • J2EE
阅读更多

 

Windows下可以参考

http://tomcat.apache.org/connectors-doc/generic_howto/quick.html

 

Solaris下:

"pkg install SUNWapch22"命令安装apache2

 

"/usr/apache2/2.2/bin/httpd -M" 命令列出安装的module,可以看到proxy_ajp_module

 

在httpd.conf中添加如下代码

 

ProxyPass /project ajp://localhost:8009/project

ProxyPassReverse /project ajp://locahost:8009/project

 

 

配置后的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.
#
# Solaris Quick Configuration Information
#
# 1. Set ServerName if necessary (default is 127.0.0.1)
# 2. Set ServerAdmin to a valid email address
#
#
# 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 "/var/apache2/2.2/logs/foo_log"
# with ServerRoot set to "/usr/apache2/2.2" will be interpreted by the
# server as "/usr/apache2/2.2//var/apache2/2.2/logs/foo_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 "/usr/apache2/2.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.
#
#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 within the appropriate 
# (32-bit or 64-bit module) /etc/apache2/2.2/conf.d/modules-*.load file so that
# the directives contained in it are actually available _before_ they are used.
#
<IfDefine 64bit>
Include /etc/apache2/2.2/conf.d/modules-64.load
</IfDefine>
<IfDefine !64bit>
Include /etc/apache2/2.2/conf.d/modules-32.load
</IfDefine>


<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 webservd
Group webservd

</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@yourhost.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 127.0.0.1

#
# 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 "/var/apache2/2.2/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 "/var/apache2/2.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

    #
    # 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 "/var/apache2/2.2/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 "/var/apache2/2.2/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 "/var/apache2/2.2/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/ "/var/apache2/2.2/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 /var/run/apache2/2.2/cgisock
</IfModule>

#
# "/var/apache2/2.2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/var/apache2/2.2/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 /etc/apache2/2.2/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 /etc/apache2/2.2/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
#

#
# 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
#
# Include all the .conf configuration files in the 
# /etc/apache2/2.2/conf.d/ directory.
#
# You can place additional configuration files in the
# /etc/apache2/2.2/conf.d/ directory 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.
#
# Sample configuration files are in the
# /etc/apache2/2.2/samples-conf.d directory. To use a 
# sample .conf file, copy it to  /etc/apache2/2.2/conf.d 
# directory and modify as required.
#
Include /etc/apache2/2.2/conf.d/*.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>

ProxyPass /project ajp://localhost:8009/project

ProxyPassReverse /project ajp://locahost:8009/project



<IfModule prefork.c>
    ListenBacklog 8192
    ServerLimit 2048
    MaxClients 2048
</IfModule>
 

 

分享到:
评论

相关推荐

    apache_server+Tomcat7集群负载均衡session共享

    通过上述配置,Apache Server 2.2和Tomcat7集群可以提供高可用和高效的Web服务,同时通过session共享保证了用户会话的连续性,提升了用户体验。提供的LICENSE、NOTICE和README文件通常包含了软件授权信息、版权声明...

    apache-tomcat-6.0.29.zip

    10. **JNDI(Java Naming and Directory Interface)**:Tomcat支持JNDI服务,允许Web应用查找和绑定资源,如数据源、邮件会话等。 11. **热部署**:在Tomcat运行时,可以修改或替换`webapps`目录下的文件,Tomcat...

    官方原版apache-tomcat-9.0.34.tar.gz

    Apache Tomcat是一款开源的Java Servlet容器,主要用于实现Java EE(现称为Jakarta EE)Web应用程序的部署和运行。它是一个轻量级应用服务器,特别适合小型到中型的应用。在这个官方原版的apache-tomcat-9.0.34.tar....

    tomcat绑定配置jdk

    标题“tomcat绑定配置jdk”意味着我们要在Tomcat的环境中指定JDK7的路径,使得Tomcat在启动时能够自动找到并使用这个版本的JDK。通常,系统环境变量`JAVA_HOME`是用来指示JDK安装位置的标准方式。但在本案例中,描述...

    apache-tomcat-9.0.65

    Apache Tomcat是一个开源的软件应用服务器,主要用于部署和运行Java Servlet和JavaServer Pages(JSP)应用程序。这个压缩包“apache-tomcat-9.0.65”是Apache Tomcat的第9.0.65版本,它包含了运行和管理Java Web...

    TOMCAT多域名绑定

    Tomcat,作为Apache软件基金会的一个开源项目,是Java Servlet和JavaServer Pages(JSP)的标准实现,广泛用于搭建Java Web应用程序。 在Tomcat中实现多域名绑定,主要涉及以下知识点: 1. **虚拟主机(Virtual ...

    apache-tomcat-8.0.47-windows-x64.zip 【Tomcat服务器,Tomcat8 windows 64位版】

    Apache Tomcat是一款开源的Java Servlet容器,主要用于运行Java Web应用程序,包括JSP和Servlet。Tomcat8是其8.x版本系列中的一个发行版,提供了许多性能优化和新特性。在这个"apache-tomcat-8.0.47-windows-x64.zip...

    实例Apache负载均衡+Tomcat集群

    而Apache HTTP Server是一款强大的Web服务器,支持多种模块扩展,通过整合mod_jk模块可以很好地与Tomcat进行配合。 2. 环境搭建: 在搭建Apache负载均衡和Tomcat集群之前,需要准备相应的硬件设备。文中提到使用两...

    apache-tomcat-9.0.41.rar

    Apache Tomcat 9.0.41 是一个广泛使用的开源软件,它是一个符合Java Servlet和JavaServer Pages(JSP)规范的应用服务器,主要用于部署和运行Java Web应用程序。这个版本的Tomcat无需安装过程,用户只需解压文件后...

    apache-tomcat-7.0.11

    Apache Tomcat是一个开源的软件应用服务器,主要用于运行Java Servlet和JavaServer Pages(JSP)应用程序。这个"apache-tomcat-7.0.11"是Tomcat的一个特定版本,代表了7.0系列的第11个次要版本。在这个绿色版本中,...

    apache-tomcat-8.5.68-windows-x64.zip

    Apache Tomcat 8.5.68 是一个广泛使用的开源软件,它是一个实现了Java Servlet、JavaServer Pages(JSP)和Java EE的Web应用程序容器。Tomcat是Apache软件基金会Jakarta项目的一部分,以其轻量级、高效和稳定而受到...

    同一台机不同IP不同tomcat.zip_boarddua_tomcat 多IP_tomcat绑定ip

    标题"同一台机不同IP不同tomcat.zip_boarddua_tomcat 多IP_tomcat绑定ip"以及描述"在同一台物理机上进行多IP配置并绑定到多tomcat上,可使用同一端口通信",明确指出了这个主题是关于在单个机器上配置多个Tomcat实例...

    apache-tomcat-8.0.18

    这个压缩包文件"apache-tomcat-8.0.18"是Apache Tomcat的第8.0.18版本,它是从官方网站下载的,确保了其可靠性与安全性。 Apache Tomcat是Java社区中的一个重要组成部分,它实现了Sun Microsystems定义的Java EE的...

    apache-tomcat-7.0.75-windows-x64.zip

    Apache Tomcat是Apache软件基金会的项目之一,与著名的HTTP服务器Apache HTTP Server不同,尽管它们都属于Apache家族。Tomcat实现了Java EE(现在称为Jakarta EE)中的Web组件规范,包括Servlet、JSP(JavaServer ...

    apache-tomcat-6.0.37.zip

    Tomcat支持多种协议,如HTTP、AJP(Apache JServ Protocol),用于与前端Web服务器如Apache HTTP Server通信。 4. **GlobalNamingResources**:全局命名资源提供了一种方式来共享数据库连接池、JMS队列等资源。 5....

    apache-tomcat-6.0.53-src

    【Apache Tomcat 6.0.53 源码包】是Java Web应用程序服务器,主要用于部署和运行Servlet和JSP应用。这个源码包包含了Tomcat的核心代码,对于开发者而言,它是一个宝贵的学习资源,可以帮助理解Tomcat的工作原理以及...

    apache-tomcat-7

    Apache Tomcat 7 是一个广泛使用的开源软件,用于部署和运行Java Servlets和JavaServer Pages (JSP)。它是Apache软件基金会的一个项目,是Java EE(现在称为Jakarta EE)的一部分,专注于轻量级应用服务器市场。这个...

    apache-tomcat-9.0.0.M20-src.tar.gz

    Apache Tomcat是一个开源的软件应用服务器,主要用于运行Java Servlet和JavaServer Pages(JSP)应用程序。它是Apache软件基金会的一部分,并且遵循Apache许可证,这使得它免费且可广泛使用。"apache-tomcat-9.0.0....

    apache-tomcat-8.5.24.zip

    Apache Tomcat是一个开源的软件应用服务器,主要用于运行Java Servlet和JavaServer Pages(JSP)技术。这个"apache-tomcat-8.5.24.zip"文件是Apache Tomcat的第8.5.24版本的压缩包,包含了运行Tomcat服务器所需的...

Global site tag (gtag.js) - Google Analytics