#all vhost should inherit this config
JkMountCopy All #所有的虚拟主机都复制该配置文件
2.3 JkRequestLogFormat参数说明:
%b Bytes sent, excluding HTTP headers (CLF format)
%B Bytes sent, excluding HTTP headers
%H The request protocol
%m The request method
%p The canonical Port of the server serving the request
%q The query string (prepended with a ? if a query string exists, otherwise an empty string)
%r First line of request
%s Request HTTP status code
%T Request duration, elapsed time to handle request in seconds '.' micro seconds
%U The URL path requested, not including any query string.
%v The canonical ServerName of the server serving the request
%V The server name according to the UseCanonicalName setting
%w Tomcat worker name
%R Session route name (available with 1.2.19 and up)
4.2. 匹配优先级说明:
The most restrictive URI pattern is applied first. More precisely the URI patterns are sorted by
the number of '/' characters in the pattern (highest number first), and rules with equal numbers
are sorted by their string length (longest first).
If both distinctions still do not suffice, then the defining source of the rule is considered.
Rules defined in uriworkermap.properties come first, before rules defined by JkMount (Apache)
and inside workers.properties using the mount attribute.
All disabled rules are ignored. Exclusion rules are applied after all normal rules have been applied.
There is no defined behaviour, for the following configuration conflict: using literally the same
URI pattern in the same defining source but with different worker targets.
5.配置httpd.conf
vi httpd.conf
在最后面加载 Include conf/mod_jk.conf
6. 配置httpd-vhosts.conf
vi extra/httpd-vhosts.conf
<VirtualHost *:80>
ServerName yourweb.com
ServerAdmin your email@mail.com
DocumentRoot "/usr/local/apache2/your doc root"
#放置Alias块
RewriteEngine on
RewriteRule ^/logging.php* yourapp/admin/ [PT]
PT 表示 passthrough,直接发个apache内部
R 表示 redirect
RewriteRule 处理快于jk匹配,Rewrite规则可以参见apache官网,它像一个钩子,可以修改很多行为
7. 使用apache Alias 实现apache 静态文件转发功能,即静态文件请求tomcat,直接通过apache提供服务
把这一段放在 <VirtualHost *:80> </VirtualHost>之间,一般放在DocumentRoot的下一行即可
Alias /yourapp/js /var/yourapp_static/js/
<Directory "/var/yourapp_static/js">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>