Apache+Tomcat+mod_rewrite的整合

今天弄了个Apache+tomcat整合,及mod_rewrite的URL重写。记录下作为个备忘:
首先:安装Apache2.2.10及tomcat6.0.15(我安装的版本)
配置Apache:修改conf/httpd.conf文件,增加以下内容(下载mod_jk.so文件,并拷贝到modules文件夹下)
# load mod_jk 
LoadModule jk_module modules/mod_jk.so

# Configure mod_jk

JkWorkersFile conf/workers.properties
JkMountFile conf/uriworkermap.properties
JkLogFile logs/mod_jk.log
JkLogLevel warn

RewriteEngine On 
#RewriteBase / 
RewriteLog  logs/rewrite.log 
RewriteLogLevel 3

RewriteRule ^/$  /olchemsources/  [R]
RewriteRule ^(.*)/index.shtml$  $1/index.do [PT]
RewriteRule ^(.*)/index_([a-z]+)_(([a-z0-9]+)(-[0-9]+)?).shtml$  $1/index.do?deal=$2&compoid=$3 [PT]


在conf下建立workers.properties及uriworkermap.properties
workers.properties文件如下:
# list the workers by name

worker.list=DLOG4J, status

# localhost server 1
# ------------------------
worker.s1.port=8009
worker.s1.host=localhost
worker.s1.type=ajp13

# localhost server 2
# ------------------------
#worker.s2.port=8209
#worker.s2.host=localhost
#worker.s2.type=ajp13
#worker.s2.stopped=1

worker.DLOG4J.type=lb
worker.retries=3
worker.DLOG4J.balance_workers=s1
worker.DLOG4J.sticky_session=1

worker.status.type=status


uriworkermap.properties文件如下:
/*=DLOG4J
/jkstatus=status

#!/*.gif=DLOG4J
#!/*.jpg=DLOG4J
#!/*.png=DLOG4J
#!/*.css=DLOG4J
#!/*.js=DLOG4J
#!/*.htm=DLOG4J
!/*.shtml=DLOG4J
!/*.html=DLOG4J

你可能感兴趣的:(apache,html,tomcat,css)