apache和tomcat相结合使用实现伪静态,同时把静态文件从工程里分离开(二)

来源:互联网 发布:苍蝇粉淘宝叫什么 编辑:程序博客网 时间:2024/05/16 10:58

 apache和tomcat相结合使用实现伪静态,同时把静态文件从工程里分离开(一)

 这篇文章,向大家介绍一下如果tomcat下有多个工程,如何通过apache用不同的域名指向不同的工程,假如,你的tomcat下有两个工程,分别是aaa和bbb。你希望通过aaa.domain.com和bbb.domain.com分别去访问这两个工程,那么,可以在httpd-vhosts.conf文件中做如下配置:
<VirtualHost *:80>
        ServerName aaa.domain.com
        DirectoryIndex index.shtml index.html
        DocumentRoot "D:/develop/ws_dream/talent/WebRoot/html"
        RewriteEngine on
        RewriteLog "logs/www.talentonline.cn-rewrite.log"
        RewriteLogLevel 9
        RewriteRule ^/([\S]+)\.jsp$ ajp://127.0.0.1:8009/aaa/$1\.jsp [P,L]
        RewriteRule ^/([\S]+)\.do$ ajp://127.0.0.1:8009/aaa/$1\.do [P,L]
</VirtualHost>

<VirtualHost *:80>
        ServerName bbb.domain.com
        DirectoryIndex index.shtml index.html
        DocumentRoot "D:/develop/ws_dream/talent/WebRoot/html"
        RewriteEngine on
        RewriteLog "logs/www.talentonline.cn-rewrite.log"
        RewriteLogLevel 9
        RewriteRule ^/([\S]+)\.jsp$ ajp://127.0.0.1:8009/bbb/$1\.jsp [P,L]
        RewriteRule ^/([\S]+)\.do$ ajp://127.0.0.1:8009/bbb/$1\.do [P,L]
</VirtualHost>
原创粉丝点击