位置: 编程技术 - 正文
推荐整理分享RHEL5 Apache+Tomcat整合,同时支持jsp与php,希望有所帮助,仅作参考,欢迎阅读内容。
文章相关热门搜索词:,内容如对您有帮助,希望把文章链接给更多的朋友!
配置环境: OS: RHEL5 with kernel 2.6.-8.1.1.el5 httpd-2.2.3-6.el5.i.rpm apache-tomcat-6.0..tar.gz jdk-6u3-linux-i.bin mod_jk-1.2.-apache-2.2.x-linux-i.so 官方宣称mod_jk-1.2.-httpd-2.2.6.so支持Apache 2.2.x及2.2.6以后的版本,但经实验,1.2.的mod_jk在RHEL5中会报错。 下载地址: 一、安装配置jdk及tomcat 1、安装jdk及tomcat [root@wardking ~]# tar zxvf apache-tomcat-6.0..tar.gz -C /usr/local/ [root@wardking ~]# mv jdk-6u3-linux-i.bin /usr/local/ [root@wardking ~]# cd /usr/local [root@wardking local]# chmod a+x jdk-6u3-linux-i.bin [root@wardking local]# ./jdk-6u3-linux-i.bin 2、配置环境变量 [root@wardking ~]# ln -sf /usr/local/apache-tomcat-6.0. /usr/local/tomcat [root@wardking ~]# ln -sf /usr/local/jdk1.6.0_ /usr/local/jdk6 [root@wardking ~]# ln -sf /usr/local/jdk6/bin/java /usr/bin/ [root@wardking ~]# ln -sf /usr/local/tomcat/bin/startup.sh /usr/bin/tomcat-up [root@wardking ~]# ln -sf /usr/local/tomcat/bin/shutdown.sh /usr/bin/tomcat-down 添加一个名为“michael”的管理员用户 [root@wardking ~]# vi /usr/local/tomcat/conf/tomcat-users.xml <user username="michael" password="" roles="manager,admin"/> 设置环境变量 [root@wardking ~]# vi /etc/profile JAVA_HOME=/usr/local/jdk6 CATALINA_HOME=/usr/local/tomcat CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$CATALINA_HOME/lib/servlet-api.jar PATH=$JAVA_HOME/bin:$PATH export JAVA_HOME CATALINA_HOME CLASSPATH PATH [root@wardking ~]# source /etc/profile 3、测试tomcat服务 [root@wardking ~]# /usr/bin/tomcat-up 或者直接执行 /usr/local/tomcat/bin/startup.sh 检查tomcat是否启动 [root@wardking ~]# netstat -anp | grep 在浏览器里访问 用户“michael”登陆管理 停止tomcat服务 [root@wardking ~]# tomcat-down 二、连接tomcat到apache 1、安装mod_jk模块 [root@wardking ~]# cp mod_jk-1.2.-apache-2.2.x-linux-i.so /etc/httpd/modules/ 2、修改apache配置文件 [root@wardking ~]# vi /etc/httpd/conf.d/mod_jk.conf LoadModule jk_module modules/mod_jk-1.2.-apache-2.2.x-linux-i.so JkWorkersFile "/etc/httpd/conf/workers.properties" JkShmFile /var/log/httpd/mod_jk.shm JkLogFile "/var/log/httpd/mod_jk.log" JkLogLevel info JkMount /*/servlet/* ajp JkMount /*.jsp ajp JkMount /*.do ajp AddType application/x-jsp .jsp 3、添加tomcat配置文件 [root@wardking ~]# vi /etc/httpd/conf/workers.properties [shm] file=/etc/httpd/logs/shm.file size= [channel.socket:localhost:] tomcatId=localhost: [uri:/jsp-examples/*] workers.tomcat_home=/usr/local/tomcat workers.java_home=/usr/local/jdk6 ps= worker.list=ajp worker.ajp.port= worker.ajp.host=localhost worker.ajp.type=ajp worker.ajp.lbfactor=1 4、设置tomcat主目录 [root@wardking ~]# vi /usr/local/tomcat/conf/server.xml <Host name="localhost" appBase="/var/www/html/" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> <Context path="" docBase="" debug="0"/> 5、确认apache、tomcat启动 [root@wardking ~]# httpd -t [root@wardking ~]# service httpd restart [root@wardking ~]# /usr/bin/tomcat-up 6、分别测试访问php和jsp网页 [root@wardking ~]# vi /var/www/html/showtime.jsp <%@page language="java" import="java.util.*"%> Now Time is : <% out.println(new Date()); %> [root@wardking ~]# echo '<?php phpinfo(); ?>' > phpinfo.php 在浏览器中访问 访问 另一种整合办法,在httpd.conf中使用反向代理: ProxyPass /images ! ProxyPass /icons ! ProxyPass / ProxyPassReverse /
查看Apache的在线用户数方法 #netstat-n|awk'/^tcp/{++S[$NF]}END{for(ainS)printa,S[a]}'
linux添加新硬盘的详细经过 拿到新盘以后就关机、插线、重开机。一切正常。进入系统以后,查看/dev下多了个hdb,然后开始分区执行fdisk/dev/hdb进入fdisk的界面,打命令n新建一个分
linux系统如何释放内存 先看看内存使用状况[root@node1~]#free-mtotalusedfreesharedbufferscachedMem:-/+buffers/cache:Swap:把内存里的数据暂时写到硬盘里[root@node1~]#syn
标签: RHEL5 Apache+Tomcat整合,同时支持jsp与php
本文链接地址:https://www.jiuchutong.com/biancheng/359226.html 转载请保留说明!友情链接: 武汉网站建设