The Apache Tomcat Connector

本文指导如何使用Apache的mod_jk模块搭建并配置TomcatConnector,包括下载编译、创建配置文件、修改httpd.conf,以及通过ip/examples进行测试。

http://tomcat.apache.org/connectors-doc/generic_howto/quick.html

搭建最简单的tomcat connector

用到了apapche 的mod_jk 模块 。

下载编译 tomcat connector

  1. wget http://mirrors.cnnic.cn/apache/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.40-src.tar.gz
  2. tar xzf tomcat-connectors-1.2.40-src.tar.gz
  3. cd tomcat-connectors-1.2.40-src
  4. yum install  httpd-devel -y
  5. cd native/
  6. which apxs
  7. ./configure --with-apxs=/usr/sbin/apxs
  8. make && make install
  9. 编译完了以后会得到一个mod_jk.so 文件,apache httpd 会用到。

 

配置一个workers.properties 文件

 

一个最小化的workers.properties文件

# Define 1 real worker using ajp13 worker.list=worker1 # Set properties for worker1 (ajp13) worker.worker1.type=ajp13 worker.worker1.host=localhost worker.worker1.port=8009
就是后端的一个tomcat的一些信息。

这个文件放在/etc/httpd/conf.d下

 

配置httpd.conf

# Load mod_jk module
  # Update this path to match your modules location
  LoadModule    jk_module  libexec/mod_jk.so
  # Declare the module for <IfModule directive> (remove this line on Apache 2.x)
  AddModule     mod_jk.c
  # Where to find workers.properties
  # Update this path to match your conf directory location (put workers.properties next to httpd.conf)
  JkWorkersFile /etc/httpd/conf/workers.properties
  # Where to put jk shared memory
  # Update this path to match your local state directory or logs directory
  JkShmFile     /var/log/httpd/mod_jk.shm
  # Where to put jk logs
  # Update this path to match your logs directory location (put mod_jk.log next to access_log)
  JkLogFile     /var/log/httpd/mod_jk.log
  # Set the jk log level [debug/error/info]
  JkLogLevel    info
  # Select the timestamp log format
  JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
  # Send everything for context /examples to worker named worker1 (ajp13)
  JkMount  /examples/* worker1

新建一个vhost

<VirtualHost 115.28.1xx.xx:80>
DocumentRoot /opt/tomcat8080/webapps
ServerName 115.28.xx
JkMount /examples/* worker1
#JkMount /servlet/* ajp13
</VirtualHost>

 

用ip/examples 访问来测试。

转载于:https://www.cnblogs.com/gqdw/p/3785812.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值