码迷,mamicode.com
首页 > 其他好文 > 详细

ubuntu整合apache和tomcat

时间:2014-06-22 20:29:44      阅读:220      评论:0      收藏:0      [点我收藏+]

标签:style   class   blog   java   http   tar   

ubuntu整合apache和tomcat
 
ubuntu:12.04.1 
apache:2 
tomcat:7.0.27 
版本号不同也没关系了,配置都是一样的。 
 
1、安装apache 
引用
aptitude install apache2
 
2、安装tomcat 
直接下载压缩文件,这个看个人的使用方法,我比较喜欢下载压缩文件。 
3、载apache连接tomcat的一个插件libapache2-mod-jk 
引用
apt-get install libapache2-mod-jk
 
4、开启jk模组及其配置 
引用
a2enmod jk
 
如果还要 启用include和rewrite模块,则执行下面的命令 
引用
a2enmod include 
a2enmod rewrite
 
5、配置apache 
修改/etc/apache2/sites-available/default文件,增加以下行 
引用
JKMount /* ajp13_worker
 
6、修改/etc/libapache2-mod-jk/worker.properties文件 
引用
workers.tomcat_home=指定到本地的tomcat路径 
workers.java_home=/home/steven/tools/jdk1.6.0_25
 
7、开启tomcat的ajp模块 
引用
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />


自己做点说明。
个人觉得ubuntu安装的apache跟其他操作系统安装有很大的区别。
其安装目录默认安装在/etc/apache2
看如下图。其配置文件为apache2.conf ,,不在是httpd.conf这个区别于其他操作系统安装的apache
bubuko.com,布布扣

下面是自己配置的一个apache url请求转发。
<VirtualHost *:80>    
ServerName www.xxx.com     
ProxyRequests Off 
ProxyVia full  
ProxyPass / http://127.0.0.1:8080/c9/
ProxyPassReverse / http://127.0.0.1:8080/c9/
        ProxyPassReverseCookiePath /c9 /                        
</VirtualHost>
所有www.xxx.com从这个网址过来的,都通过请求转发到我们的http://127.0.0.1:8080/c9/  这个项目。
ProxyPassReverseCookiePath /c9 /     这个作用就是为了防止,apache在请求转发过程中session丢失。

<VirtualHost *:80>    
ServerName www.csart.net  
ServerAlias csart.net   
ProxyRequests Off 
ProxyVia full  
ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/
</VirtualHost>


Linux系统为Ubuntu

一、Start Apache 2 Server /启动apache服务

# /etc/init.d/apache2 start
or
$ sudo /etc/init.d/apache2 start

二、 Restart Apache 2 Server /重启apache服务

# /etc/init.d/apache2 restart
or
$ sudo /etc/init.d/apache2 restart

三、Stop Apache 2 Server /停止apache服务

# /etc/init.d/apache2 stop
or
$ sudo /etc/init.d/apache2 stop





ubuntu整合apache和tomcat,布布扣,bubuko.com

ubuntu整合apache和tomcat

标签:style   class   blog   java   http   tar   

原文地址:http://blog.csdn.net/baicp3/article/details/32368173

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!