`

apache+mod_jk+tomcat安装配置指南(一)

阅读更多

dell 2950 服务器为64位,8G,双CPU双核

apache 2.2.11

jdk6u12

tomcat 6.0.16

mod_jk 1.2.27

tomcat native 1.1.16

 

第一步,apache:

 

解压apache源码,进入srclib/apr,安装之:

./configure --prefix=/opt/app/apr 
make 
sudo make install

 进入srclib/apr-util

 ./configure --prefix=/opt/app/apr-util --with-apr=/opt/app/apr
make
sudo make install

 

进入apache源码根目录:

./configure  --libdir=/usr/lib64 --enable-nonportable-atomics=yes  --disable-actions  --disable-asis --disable-auth-basic --disable-authn-default --disable-authn-file --disable-authz-default --disable-authz-groupfile --disable-authz-user --disable-autoindex --disable-cgi --disable-cgid --disable-env --disable-filter --disable-imagemap --disable-include --disable-isapi --disable-negotiation --disable-nw_ssl --disable-userdir --enable-modules="so" --enable-mods-shared="deflate  status cache mem-cache disk-cache rewrite headers setenvif proxy proxy_ajp proxy_balancer proxy_http" --with-apr=/opt/app/apr --with-apr-util=/opt/app/apr-util --prefix=/opt/app/apache-boss --with-mpm=worker
make
sudo make install

  如果在 configure时提示deflate相关的错误,则是没有安装zlib-devel,安装之.

另一种编译参数

CFLAGS="-march=pentium4 -O3 -pipe -fomit-frame-pointer" ./configure --prefix=/opt/apache2 --disable-authn-file --disable-authn-default --disable-authz-host --disable-authz-groupfile --disable-authz-user --disable-authz-default --disable-auth-basic --disable-include --disable-filter --disable-charset-lite --disable-log-config --disable-env --disable-setenvif --disable-mime --disable-status --disable-autoindex --disable-asis --disable-cgid --disable-cgi --disable-negotiation --disable-dir --disable-actions --disable-userdir --disable-alias --enable-suexec --enable-http --enable-suexec --enable-proxy --enable-proxy-http --enable-proxy-balancer --enable-static-support --enable-static-htpasswd --enable-static-htdigest --enable-static-rotatelogs --enable-static-logresolve --enable-static-htdbm --enable-static-ab --enable-static-checkgid --with-mpm=prefork
 

 

 

第二步:mod_jk:

 

     进入mod_jk源码tomcat-connectors-1.2.27-src/native:

 

 

./configure --with-apxs=/opt/app/apache-boss/bin/apxs
make
sudo make install
 

第三步:jdk

    在/opt/app下面运行jdk的二进制,然后:

sudo ln -s /opt/app/jdk1.6.0_12 /opt/app/java

 

第四步:tomcat

 

cp apache-tomcat-6.0.16 /opt/app/tomcat-boss-a
cp apache-tomcat-6.0.16 /opt/app/tomcat-boss-a

 

第五步:修改apache配置文件

sudo vim /opt/app/apache-boss-2.2.11/conf/httpd.conf
 
ServerRoot "/opt/app/apache-boss"
Listen 80
#
#LoadModule cache_module modules/mod_cache.so
#LoadModule disk_cache_module modules/mod_disk_cache.so
#LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule    jk_module  modules/mod_jk.so
#LoadModule status_module      modules/mod_status.so


<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
User daemon
Group daemon

</IfModule>
</IfModule>





DocumentRoot "/opt/webapps/boss"

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

<Directory "/opt/webapps/boss">
    Options FollowSymLinks

    AllowOverride None
Order allow,deny
    Allow from all

</Directory>

<IfModule dir_module>
    DirectoryIndex index.html index.jsp
</IfModule>

<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</FilesMatch>

ErrorLog "logs/error_log"

LogLevel warn

<IfModule log_config_module>
    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>

    CustomLog "logs/access_log" combined

</IfModule>

<IfModule alias_module>
   # ScriptAlias /cgi-bin/ "/opt/app/apache-boss/cgi-bin/"

</IfModule>

<IfModule cgid_module>
    #Scriptsock logs/cgisock
</IfModule>

<Directory "/opt/app/apache-boss/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

#
DefaultType text/plain

<IfModule mime_module>
    TypesConfig conf/mime.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 .gzjs

    #
    # 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>

#
#MIMEMagicFile conf/magic

#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
ErrorDocument 503 /503.htm
ErrorDocument 404 /404.htm

#
#EnableMMAP off
EnableSendfile on

# 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>
JkWorkersFile conf/workers.properties
JkShmFile     conf/mod_jk_boss.shm
JkLogFile     /var/log/mod_jk_boss.log
JkLogLevel    error
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions     +RejectUnsafeURI

#<Location />
#SetOutputFilter DEFLATE
# Don't compress images
#SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

# Make sure proxies don't deliver the wrong content
#Header append Vary User-Agent env=!dont-vary
#</Location> 
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css
#ExtendedStatus On
#<location /server-status>
#    SetHandler server-status
#    Order Deny,Allow
#    Deny from all
#    Allow from all
#</location>

 

 

更改/opt/app/apache-boss/conf/extra/httpd-default.conf

 

Timeout 60
KeepAlive On
MaxKeepAliveRequests 500
KeepAliveTimeout 1
UseCanonicalName Off
AccessFileName .htaccess
ServerTokens Prod
ServerSignature Off
HostnameLookups Off

 更改/opt/app/apache-boss/conf/extra/httpd-mpm.conf

<IfModule mpm_worker_module>
    ServerLimit          64
    ThreadLimit          150
    StartServers          5
    MaxClients         1500
    MinSpareThreads      450
    MaxSpareThreads      800
    ThreadsPerChild      150
    MaxRequestsPerChild   1000000
</IfModule>

 更改/opt/app/apace-boss/conf/extra/httpd-vhosts.conf

根据自己的情况更改,注意要有这一句

 

    JkMountFile conf/boss-uriworkermap.properties
 

 

 

 

0
0
分享到:
评论

相关推荐

    apache+tomcat+mod_jk

    apache+tomcat+mod_jk整合文档,内有安装包。apache+tomcat+mod_jk整合文档,内有安装包。

    Apache+mod_jk+Tomcat负载均衡配置

    ### Apache+mod_jk+Tomcat负载均衡配置详解 #### 一、背景介绍 随着互联网技术的迅猛发展,单一服务器已经难以满足日益增长的服务需求。负载均衡技术应运而生,成为提高服务可用性和扩展性的关键手段之一。本文将...

    Apache+Tomcat+mod_jk+mod_ssl配置笔记

    在配置Apache与Tomcat的连接时,我们需要在httpd.conf中添加mod_jk的配置,例如启用mod_jk模块,设置worker定义(这将在workers.properties文件中详细描述)以及虚拟主机或路径的重定向规则。 接下来,workers....

    Apache + mod_jk + tomcat(64)

    Apache、mod_jk和Tomcat的组合是一种常见的Web服务器与应用服务器集成方案,用于构建高性能、高可用性的Java Web应用程序集群。在这个配置中,Apache作为前端的反向代理服务器,负责接收HTTP请求,并通过mod_jk模块...

    apache + tomcat + mod_jk集群

    4. **配置mod_jk**:在Apache的配置文件httpd.conf中,添加mod_jk的LoadModule语句,然后创建一个名为workers.properties的文件,定义Tomcat集群的服务器实例。每个实例包括IP地址、端口、工作目录等信息。 5. **...

    tomcat集群-Apache2.2.4+And+mod_jk.so+tomcat配置文件

    总结来说,"tomcat集群-Apache2.2.4+And+mod_jk.so+tomcat配置文件"的配置涉及到多个步骤,包括Apache和Tomcat的安装、mod_jk模块的集成、配置文件的修改以及负载均衡策略的设定。这个过程对于构建高可用、高性能的...

    apache2.4 +tomcat7+mod_jk.so 完美整合实例

    Apache 2.4、Tomcat 7 和 mod_jk.so 的整合是将 Apache 作为前端服务器,用于处理静态内容和反向代理,而 Tomcat 作为后端应用服务器,主要负责处理 Java Servlet 和 JSP。这种架构组合可以充分利用 Apache 的高性能...

    RedHat_linux+apache+tomcat+mod_jk_负载均衡安装说明

    通过以上步骤,我们完成了在 Red Hat Linux 9.0 上安装 Apache、Tomcat 和 Mod_jk 的过程,并进行了简单的负载均衡配置。这些配置能够帮助我们更好地管理应用服务器集群,提高系统的稳定性和性能。当然,实际部署时...

    mod_jk各个版本 apache与tomcat 整合

    mod_jk 是 Apache Tomcat Connector 的一部分,用于在 Apache 和 Tomcat 之间传递请求。mod_jk 提供了多种版本,这些版本根据操作系统和 Apache 的版本进行了区分。以下是一些关键版本信息: - **Windows 平台**:...

    Tomcat+apache+mod_jk实现负载均衡和集群配置

    总之,利用Apache+Tomcat+mod_jk实现的负载均衡和集群配置是一种常见的Web服务器解决方案,它提供了一种灵活、可扩展的方式,以应对高并发访问和服务器故障的情况。在实际部署中,还需要考虑监控、性能调优以及安全...

    apache2.2+mod_jk

    本压缩包包含 httpd-2.2.25-win32-x86-openssl-0.9.8y.msi 和mod_jk-apache-2.2.2 经测试 apache+tomcat整合成功(tomcat为7.042)操作系统为Windows 2008 SP2

    apache2.4+tomcat7+mod_jk.so_整合配置

    Apache 2.4 和 Tomcat 7 的整合配置主要依赖于 mod_jk 模块,这是一个 Apache HTTP 服务器的模块,用于与 Tomcat 进行负载均衡和通信。`mod_jk.so` 是该模块的动态链接库文件,用于在 Apache 和 Tomcat 之间建立连接...

    Apache2.4服务器+mod_jk.so

    4. **配置mod_jk**:创建一个新的配置文件,例如`workers.properties`,定义Apache与Tomcat之间的连接。在该文件中,我们会指定Tomcat实例的IP地址、端口以及工作线程数等信息。 5. **配置虚拟主机**:在`httpd-...

    Apache2.2.25 + Tomcat6.0.45 + mod_jk + 测试页面 + 集群

    本资源包含了文章Apache2.2.x + Tomcat6.x + JK 集群配置,http://blog.csdn.net/qq396229783/article/details/74295797里面所用到的软件配置

    Tomcat+Apache+JK集群

    【标题】"Tomcat+Apache+JK集群"指的是在Web服务器架构中,通过Apache HTTP Server与Tomcat应用服务器结合,并利用JK模块实现负载均衡和高可用性的集群部署方式。这种方式可以提升系统的性能和稳定性,应对高并发...

    apache2 通过mod_jk与tomcat配置

    本篇文章将详细介绍如何在Ubuntu 10.04系统环境下,配置Apache2通过mod_jk连接到Tomcat 6.0.24。 首先,确保你已经安装了Apache2和Tomcat。在Ubuntu上,可以通过以下命令安装: ```bash sudo apt-get update sudo ...

    两台服务器上做Apache2.2+Tomcat6.0+mod_jk的负载均衡

    "两台服务器上做Apache2.2+Tomcat6.0+mod_jk的负载均衡"是一个典型的分布式系统架构,旨在通过在多台服务器之间分配工作负载来提高系统的稳定性和性能。下面将详细介绍这个配置涉及的知识点: 1. **Apache ...

    Apache 2.2.15+mod_jk

    mod_jk是Apache的一个模块,它是Apache与Tomcat之间的连接器,用于在Apache Web服务器和Java应用服务器(通常是Tomcat)之间进行通信。mod_jk的主要任务是负载均衡、故障转移和请求转发,使得动态内容(如Java ...

Global site tag (gtag.js) - Google Analytics