前言:
如今大家对“apache摸人家在mod_jk”大概比较讲究,朋友们都需要分析一些“apache摸人家在mod_jk”的相关文章。那么小编也在网摘上汇集了一些有关“apache摸人家在mod_jk””的相关知识,希望各位老铁们能喜欢,各位老铁们一起来学习一下吧!1.下载安装包httpd-2.2.23.tar.bz2 (官方地址:)
2.把压缩包放到/usr/local/下。
3.解压:tar -xvjf httpd-2.2.23.tar.bz2
4.安装:
cd httpd-2.2.23
安装APR
cd srclib/apr
./configure --prefix=/usr/local/apr
make
make install
安装APR-util
cd srclib/apr-util
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make
make install
安装Apache
cd httpd-2.2.23
./configure --prefix=/usr/local/apache --enable-so --enable-mods-shared=all --enable-modules=most --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
make
make install
5.加载模块:进入/usr/local/apache/bin路径下:连着一起的
./apxs -aic /usr/local/httpd-2.2.23/modules/proxy/mod_proxy.c ./apxs -aic /usr/local/httpd-2.2.23/modules/proxy/proxy_util.c./apxs -aic /usr/local/httpd-2.2.23/modules/proxy/mod_proxy_http.c
6.修改/usr/local/apache/conf/httpd.conf文件:在文件最后加上要配置的代理服务
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /platforms
ProxyPassReverse /platforms
ProxyPass /map
ProxyPassReverse /map http:192.168.32.201
7.修改端口:
httpd.conf文件中查找 Listen 80,把80改成你想设置的端口
8.修改服务名称:
httpd.conf文件中查找ServerName,找到#ServerName ;把ServerName前面的#去掉,把改成ServerName localhost:80;
9.重启apache注意端口号的占用(查看端口命令:lsof -i:端口号)如果端口占用,先杀掉所有
10.改变redhat的系统语言/字符集
改变redhat的系统语言/字符集修改 /etc/sysconfig/i18n 文件,如
LANG="en_US",英文,
LANG="zh_CN.GBK",中文。
11.安装mod_jk
tar -zxvf /usr/local/tomcat-connectors-1.2.37-src.tar.gz
cd /usr/local/tomcat-connectors-1.2.37-src/native/
./configure --with-apxs=/usr/local/apache/bin/apxs
--with-java-home=/usr/local/jdk1.6.0_29
make
make install
/opt/jdk1.6/jdk1.6.0_27
将路径/usr/local/apache/conf/extra中workers.properties文件修改
一、 如果启动不了,查看/usr/local/apache/logs/error_log日志
如果提示mod_unique_id.so有问题
修改/usr/local/etc/apache22/httpd.conf
将LoadModule unique_id_module libexec/apache22/mod_unique_id.so这一行给注销掉
1.http.conf
#ErrorLog "logs/error_log"
ErrorLog "|/usr/local/apache/bin/rotatelogs /usr/local/apache/logs/error-%Y-%m-%d.log 86400"
#CustomLog "logs/access_log" common
CustomLog "|/usr/local/apache/bin/rotatelogs /usr/local/apache/logs/access-%Y-%m-%d.log 86400" common
ProxyPass /foreign
ProxyPassReverse /foreign
LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/extra/workers.properties
JkMount /* controller
2.work.proterties
#这里可以配置任意多个Tomcat,此处配置了2个Tomat服务器.
#host和port根据自己实际配置.实例配置的是本机两个tomcat,分别使用不同的端口.避免冲突
#如果Tomcat不再同一机器上,没必要改端口的。
#server 列表
worker.list=controller,tomcat1,tomcat3
#========tomcat1========
worker.tomcat1.port=9900 #ajp13 端口号,在tomcat下server.xml配置,默认8009
worker.tomcat1.host=192.168.171.237 #tomcat的主机地址,如不为本机,请填写ip地址
worker.tomcat1.type=ajp13
worker.tomcat1.lbfactor=1 #server的加权比重,值越高,分得的请求越多
#========tomcat3========
worker.tomcat3.port=9902 #ajp13 端口号,在tomcat下server.xml配置,默认8009
worker.tomcat3.host=192.168.171.235 #tomcat的主机地址,如不为本机,请填写ip地址
worker.tomcat3.type=ajp13
worker.tomcat3.lbfactor=1 #server的加权比重,值越高,分得的请求越多
#========controller,负载均衡控制器========
worker.controller.type=lb
#指定此负载平衡器负责的Tomcat应用节点。
worker.controller.balanced_workers=tomcat1,tomcat3 #指定分担请求的tomcat
#此处指定集群是否需要会话复制,如果设为true,则表明为会话粘性,不进行会话复制,当某用户的请求第一次分发到哪台
#Tomcat后,后继的请求会一直分发到此Tomcat服务器上处理;如果设为false,则表明需求会话复制。
worker.controller.sticky_session=false #设为false,则表明需求会话复制。
3.http.conf配置均衡负载
ProxyRequests Off
# customer
ProxyPass /platformsCustomer balancer://platformsCustomer stickysession=JSESSIONID nofailover=On
ProxyPassReverse /platformsCustomer balancer://platformsCustomer
<proxy balancer://platformsCustomer>
BalancerMember loadfactor=1
BalancerMember loadfactor=1
</proxy>
感谢江荣*多年前的指导和帮助,让我能够学到Apache的安装方法,非常感谢。
标签: #apache摸人家在mod_jk