ubuntu整合apache和tomcat
来源:互联网 发布:js audio loop 编辑:程序博客网 时间:2024/05/16 17:43
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
下面是自己配置的一个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/ 这个项目。
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丢失。(通过apache访问Tomcat,session丢失的问题)
NOTE: Don’t forget the trailing /at the end of the mapped URL for ProxyPass and ProxyPassReverse; otherwise your traffic will get redirected to invalid URLs like http://mydomain.comblahblah, instead of /blahblah.
NOTE: Don’t forget the trailing /at the end of the mapped URL for ProxyPass and ProxyPassReverse; otherwise your traffic will get redirected to invalid URLs like http://mydomain.comblahblah, instead of /blahblah.
<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
对自己在补充一点。
<VirtualHost *:80>
ServerName www.c9cn.com
ServerAlias c9cn.com
RewriteEngine on
ProxyRequests Off
ProxyVia full
ProxyPass /s/ http://127.0.0.1:8080/s/
ServerName www.c9cn.com
ServerAlias c9cn.com
RewriteEngine on
ProxyRequests Off
ProxyVia full
ProxyPass /s/ http://127.0.0.1:8080/s/
//页面通过不同的路径访问,访问到不同的项目,如www.c9cnxxx.com/s/ 访问solr
ProxyPassReverse /s/ http://127.0.0.1:8080/s/
ProxyPass / http://127.0.0.1:8080/c9/
ProxyPassReverse / http://127.0.0.1:8080/c9/
ProxyPassReverseCookiePath /c9 /
</VirtualHost>
ProxyPassReverse /s/ http://127.0.0.1:8080/s/
ProxyPass / http://127.0.0.1:8080/c9/
ProxyPassReverse / http://127.0.0.1:8080/c9/
ProxyPassReverseCookiePath /c9 /
</VirtualHost>
0 0
- ubuntu整合apache和tomcat
- Tomcat和Apache整合
- 整合tomcat和apache
- 整合tomcat和apache
- tomcat和apache整合
- 整合Apache和Tomcat
- 整合Apache和Tomcat
- 整合Tomcat和Apache
- Apache和Tomcat 整合
- Apache和Tomcat整合
- apache和tomcat整合
- tomcat和apache整合
- apache和tomcat整合
- 整合 Apache 和tomcat
- apache和tomcat整合
- apache和tomcat整合
- Apache和Tomcat整合
- Apache和Tomcat整合
- 黑马程序员----java基础加强(3)
- 选手评分问题
- 黑马程序员--集合
- WebSphere客户端迁移的一般问题
- FreeType 字体库使用 (简易的字形装载和实际应用)
- ubuntu整合apache和tomcat
- 异常处理总结 (资料不断整理与收集)
- Struts2 零配置(1)
- ViewPager组件
- Java学习总结13——J2EE规范1(J2SE J2EE J2ME的区别)
- ceshi
- linux上安装ant
- 博客准备再次搬迁!
- [转]嵌入式linux GUI--DirectFB + GTK