昊漫玉 发表于 2015-8-3 10:01:59

基于Apache与Tomcat的Java平台部署方案

  1. 下载安装jdk-6u17-linux-x64-rpm.bin,并修改JAVA路径与PATH变量;
  2. 下载安装httpd-2.2.14
  编译安装命令依次如下:
  ./configure --prefix=/usr/local/apache2 --enable-so
  make
  make install
  3. 下载安装tomcat-connectors-1.2.30-src.tar
  cd native
  ./configure --with-apxs=/usr/local/apache2/bin/apxs
  make
  cp /native/apache-2.0/mod_jk.so /usr/local/apache2/modules/
  cp /conf/httpd_jk.conf /usr/local/apache2/conf/extra/
  cp /conf/ workers.properties.minimal /usr/local/apache2/conf/workers.properties
  4 下载配置apache-tomcat-6.0.20
  注意修改/conf/server.xml中的几个端口号,默认是8080端口,我们改为8081,另外AJP13使用的是8009端口,我们这里改为9001。总之注意不要与其他tomcat实例以及其他系统的端口有冲突;
  4. 配置apache
  修改httpd.conf
  Listen :80
  # Virtual hosts
  Include conf/extra/httpd-vhosts.conf
  # mod_jk
  Include conf/extra/httpd-jk.conf
  5. 修改workers.properties文件
  在worker.list后面添上testworker
  worker.testworker.type=ajp
  worker.testworker.port=9001
  6, 修改httpd-vhosts.conf
  
  ServerAdmin webmaster@www.test.com
  
  DocumentRoot "/usr/local/tomcat_instances/www.test.com/webapps/ROOT"
  
  ServerName www.test.com
  ServerAlias www.test.com
  ErrorLog "logs/www.test.com-error_log"
  CustomLog "logs/www.test.com-access_log" common
  
  JkMount /servlet/* testworker
  JkMount /*.jsp testworker
  JkMount /*.do testworker
  DirectoryIndex index.html index.htm index.jsp
  
  
  Options FollowSymLinks
  AllowOverride None
  Order deny,allow
  Allow from all
  
  
  7, 可以先修改本地hosts文件做一下测试,
  127.0.0.1 www.test.com
  apache2/bin/apachectl –k start可输入http://localhost/ 看看是否能展现测试页
  tomcat/bin/startup.sh 可输入http://localhost:[端口号,这里是8081]看看tomcat是否正常
页: [1]
查看完整版本: 基于Apache与Tomcat的Java平台部署方案