#引入配置文件
Include conf/http-vhosts.conf
Include conf/mod_jk.conf
# add compress start
LoadModule headers_module modules/mod_headers.so
LoadModule deflate_module modules/mod_deflate.so
# add compress end
#
# Dynamic Shared Object (DSO) Support
* 在conf下面新建http-vhosts.conf内容如下:
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin admin@yoursite.com
DocumentRoot "e:/site/apache/www.yoursite.com"
ServerName yoursite.com
ServerAlias www.yoursite.com
ErrorLog "logs/www.yoursite.com-error.log"
CustomLog "logs/www.yoursite.com-access.log" common
# add compress start
<Location "/">
SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
Header append Vary User-Agent env=!dont-vary
</Location>
# add compress end
<Directory "e:/site/apache/www.yoursite.com">
#
# 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>
</VirtualHost>
# Where to find workers.properties
JkWorkersFile conf/workers.properties
# Where to put jk shared memory
JkShmFile logs/httpd/mod_jk.shm
# Where to put jk logs
JkLogFile logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T %R"
# All requests go to Tomcat by default
JkMount /* www
# Serve html, jpg and gif etc using Apache
JkUnMount /*.css www
JkUnMount /*.js www
JkUnMount /*.gif www
JkUnMount /*.jpg www
JkUnMount /*.htm www
JkUnMount /*.swf www
JkUnMount /*.xml www
JkUnMount /*.ico www
# png and flv mount to tomcat
#JkUnMount /*.png www
#JkUnMount /*.flv www
* 在conf下新建文件workers.properties,内容如下:
#
# workers.properties
#
# list the workers by name
worker.list=www
worker.maintain=60
# =============================================================================
# ------------------------
# www1 server 0.2
# ------------------------
worker.www1.port=8009
worker.www1.host=192.168.0.2
worker.www1.type=ajp13
worker.www1.socket_timeout=0
worker.www1.socket_keepalive=true
worker.www1.lbfactor=10
# Define preferred failover node for worker1
#worker.www1.redirect=www2
# ------------------------
# www2 server 0.2
# ------------------------
worker.www2.port=9009
worker.www2.host=192.168.0.2
worker.www2.type=ajp13
worker.www2.socket_timeout=0
worker.www2.socket_keepalive=true
worker.www2.lbfactor=10
#Disable worker2 for all requests except failover
#worker.worker2.activation=disabled
# ------------------------
# Load Balancer worker
# ------------------------
worker.www.type=lb
#worker.www.balance_workers=www2
worker.www.balance_workers=www1,www2
worker.www.sticky_session=true
#worker.www.method=Traffic
# ----------------------
#
#-----------------------
# Add the status worker to the worker list
#worker.list=jkstatus
# Define a 'jkstatus' worker using status
#worker.jkstatus.type=status
# Add the jkstatus mount point
#JkMount /jkmanager/* jkstatus
# ===========================================================================
#
# END workers.properties
#