cd /opt/soft
gzip -d httpd-2.2.20.tar.gz
tar -xvf httpd-2.2.20.tar
2.5创建apche安装目录
cd /opt
mkdir cist
cd cist
mkdir apache2
2.6拷贝httpd-2.2.20文件到/opt/cist目录下
cd /opt/soft
cp -r httpd-2.2.20 /opt/cist/httpd-2.2.20
2.7配置apche安装环境,编译,安装.
./configure --prefix=/opt/cist/apache2/ --enable-proxy --enable-proxy-ajp --enable-proxy-balancer --enable-proxy-connect --enable-proxy-http --enable-info
make
make install
2.8修改配置文件
cd /opt/cist/apche2/conf
vi httpd.conf
把以下的两行
User daemon
Group daemon
改为
User nobody
Group nobody
3.配置apche负载
3.1修改配置文件httpd.conf
cd /opt/cist/apche2/conf
vi httpd.conf
# 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
<!--取消注释,配置apche虚拟主机-->
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>
cd /opt/cist/apache2/conf/extra/
vi httpd-info.conf
#
# Get information about the requests being processed by the server
# and the configuration of the server.
#
# Required modules: mod_status (for the server-status handler),
# mod_info (for the server-info handler)
#
# Allow server status reports generated by mod_status,
# with the URL of http://servername/server-status
# Change the ".localhost" to match your domain to enable.
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
<!--修改为all,允许所有IP访问. 默认为.localhost只允许localhost访问-->
Allow from all
</Location>
#
# ExtendedStatus controls whether Apache will generate "full" status
# information (ExtendedStatus On) or just basic information (ExtendedStatus
# Off) when the "server-status" handler is called. The default is Off.
#
ExtendedStatus On
#
# Allow remote server configuration reports, with the URL of
# http://servername/server-info (requires that mod_info.c be loaded).
# Change the ".localhost" to match your domain to enable.
#
<Location /server-info>
SetHandler server-info
Order deny,allow
Deny from all
<!--修改为all,允许所有IP访问. 默认为.localhost只允许localhost访问-->
Allow from all
</Location>
<!--开启负载信息监控-->
<Location /balancer-manager>
SetHandler balancer-manager
Order Deny,Allow
Deny from all
Allow from all
</Location>
3.3配置apche虚拟主机
修改配置文件httpd-vhosts.conf
cd /opt/cist/apache2/conf/extra/
vi 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 webmaster@dummy-host.localhost
DocumentRoot "D:/Apache2.2/docs/dummy-host.localhost"
<!-- 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 appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="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" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log." resolveHosts="false" suffix=".txt"/>
</Host>
</Engine>
3.6修改JAVAEE应用中WebRoot/WEB-INF/web.xml文件