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
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值