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.--escaped_anchor:3470e7efc9d2fc0f6a96039a71c7a880--.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.
#
LoadModule headers_module modules/mod_headers.so
LoadModule expires_module modules/mod_expires.so
ExpiresActive On
ExpiresByType text/css A259200
#text/css类型文件的过期设置为“访问后的259200秒”
ExpiresByType application/x-javascript A259200
# application/x-javascript类型文件的过期设置为“访问后的300秒”
ExpiresByType image/png A2592000
#image/png类型文件的过期设置为“访问后的2592000秒”
ExpiresByType image/gif A2592000
#image/gif类型文件的过期设置为“访问后的2592000秒”
ExpiresByType application/x-shockwave-flash A2592000
# application/x-shockwave-flash类型文件的过期设置为“访问后的2592000秒”
LoadModule deflate_module modules/mod_deflate.so
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css
NameVirtualHost *
#
# 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.
#
LoadModule jk_module modules/mod_jk-apache-2.2.4.so
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JklogLevel error
JkOptions +ForwardURICompatUnparsed
JkOptions +ForwardSSLCertChain
<VirtualHost *>
ServerAdmin admin@www.618119.com
DocumentRoot /www/docs/www.618119.com
ServerName 618119.com
ServerAlias www.618119.com
ErrorLog logs/www.618119.com-error.log
CustomLog “|bin/cronolog.exe logs/www.618119.com-access%Y%m%d.log” combined
JkMount / www
JkMount /* www
JkMount /jkstatus jkstatus
<Location /jkstatus>
Order deny,allow
Allow from 127.
</Location>
</VirtualHost>
<VirtualHost *>
ServerAdmin admin@blog.618119.com
DocumentRoot /www/docs/blog.618119.com
ServerName www.blog.618119.com
ServerAlias *.blog.618119.com
ErrorLog logs/blog.618119.com-error.log
CustomLog “|bin/cronolog.exe logs/blog.618119.com-access%Y%m%d.log” combined
JkMount /* blog
JkMount /jkstatus jkstatus
<Location /jkstatus>
Order deny,allow
Allow from 127.
</Location>
</VirtualHost>
<VirtualHost *>
ServerAdmin admin@www.618119.com
DocumentRoot /www/docs/lizongbo.618119.com
ServerName lizongbo.618119.com
ErrorLog logs/lizongbo.618119.com-error.log
CustomLog “|bin/cronolog.exe logs/lizongbo.618119.com-access%Y%m%d.log” combined
JkMount / ring
JkMount /* ring
</VirtualHost>
workers.properties的配置示例如下:
# workers.properties -
#
# This file provides jk derived plugins with the needed information to
# connect to the different tomcat workers. Note that the distributed
# version of this file requires modification before it is usable by a
# plugin.
#
# As a general note, the characters $( and ) are used internally to define
# macros. Do not use them in your own configuration!!!
#
# Whenever you see a set of lines such as:
# x=value
# y=$(x)\something
#
# the final value for y will be value\something
#
# Normaly all you will need to do is un-comment and modify the first three
# properties, i.e. workers.tomcat_home, workers.java_home and ps.
# Most of the configuration is derived from these.
#
# When you are done updating workers.tomcat_home, workers.java_home and ps
# you should have 5 workers configured:
#
# - An ajp12 worker that connects to localhost:8007
# - An ajp13 worker that connects to localhost:8009
# - An ajp13 worker that connects to localhost:8809
# - A jni inprocess worker.
# - A load balancer worker
#
# However by default the plugins will only use the ajp12 worker. To have
# the plugins use other workers you should modify the worker.list property.
#
#
# OPTIONS ( very important for jni mode )
#
# workers.tomcat_home should point to the location where you
# installed tomcat. This is where you have your conf, webapps and lib
# directories.
#
workers.tomcat_home=/618119.com/apache-tomcat-6.0.14
#
# workers.java_home should point to your Java installation. Normally
# you should have a bin and lib directories beneath it.
#
workers.java_home=/usr/java/jdk1.6.0_03
#
# You should configure your environment slash… ps=\ on NT and / on UNIX
# and maybe something different elsewhere.
#
ps=/
#
#—— ADVANCED MODE ————————————————
#———————————————————————
#
#
#—— DEFAULT worket list ——————————————
#———————————————————————
#
#
# The workers that your plugins should create and work with
#
# Add ‘inprocess’ if you want JNI connector
worker.list=www, blog, lizongbo, jkstatus
# , inprocess
#
#—— DEFAULT bk WORKER DEFINITIONS —————————–
#———————————————————————
#
worker.tomcat11080.port=11009
worker.tomcat11080.host=127.0.0.1
worker.tomcat11080.type=ajp13
worker.tomcat11080.lbfactor=1
worker.tomcat12080.port=12009
worker.tomcat12080.host=127.0.0.1
worker.tomcat12080.type=ajp13
worker.tomcat12080.lbfactor=1
worker.tomcat13080.port=13009
worker.tomcat13080.host=127.0.0.1
worker.tomcat13080.type=ajp13
worker.tomcat13080.lbfactor=1
worker.tomcat14080.port=14009
worker.tomcat14080.host=127.0.0.1
worker.tomcat14080.type=ajp13
worker.tomcat14080.lbfactor=1
#—— DEFAULT smk WORKER DEFINITIONS —————————–
#———————————————————————
#
#
# Defining a worker named ajp13 and of type ajp13
# Note that the name and the type do not have to match.
#
#
# Specifies the load balance factor when used with
# a load balancing worker.
# Note:
# —-> lbfactor must be > 0
# —-> Low lbfactor means less work done by the worker.
#
# Specify the size of the open connection cache.
#worker.smk.cachesize
#
#—— DEFAULT LOAD BALANCER WORKER DEFINITION ———————-
#———————————————————————
#
#
# The loadbalancer (type lb) workers perform wighted round-robin
# load balancing with sticky sessions.
# Note:
# —-> If a worker dies, the load balancer will check its state
# once in a while. Until then all work is redirected to peer
# workers.
worker.www.type=lb
worker.www.balanced_workers=tomcat11080,tomcat12080
worker.blog.type=lb
worker.blog.balanced_workers=tomcat13080
worker.lizongbo.type=lb
worker.lizongbo.balanced_workers=tomcat14080
worker.jkstatus.type=status
Tags: ajp13, Apache, mod_jk, Tomcat, vhostRelated posts
Tags: ajp13, Apache, mod_jk, Tomcat, vhost