linux系统下Apache与jboss的整合,求解急求
发布网友
发布时间:2022-10-10 04:26
我来回答
共1个回答
热心网友
时间:2024-12-03 19:56
一、安装APACHE:
编译前配置:
./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --enable-ssl --with-ssl=/usr/lib --enable-auth-digest --enable-cgi --enable-suexec --with-suexec-caller=daemon --with-suexec-docroot=/usr/local/apache2/htdocs
(--prefix=/usr/local/apache2 指定APACHE安装路径
--enable-so 使httpd服务可以动态的加载模块功能
--enable-rewrite 使httpd服务具有rewrite网页地址重写功能)
编译并安装:
make && make install
查看服务:netstat -anpt |grep 80
2.安装JDK
chmod +x jdk-6u18-linux-i586.bin
./jdk-6u18-linux-i586.bin
mv jdk1.6.0_18 /usr/local/jdk
rm -rf /usr/bin/java
rm -rf /usr/bin/javac
ln -s /usr/local/jdk/bin/java /usr/bin/java
ln -s /usr/local/jdk/bin/javac /usr/bin/javac
[root@centoslamp src]# java -version
java version "1.6.0_18"
Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java HotSpot(TM) Client VM (build 16.0-b13, mixed mode, sharing)
ln -s /usr/local/jdk/jre /usr/local/jre
设置环境变量
vi /etc/profile 添加如下内容
JAVA_HOME=/usr/local/jdk
export JAVA_HOME
JRE_HOME=/usr/local/jre
export JRE_HOME
运行,使环境变量生效
source /etc/profile
3.安装tomcat
tar zxvf apache-tomcat-7.0.6.tar.gz
mv apache-tomcat-7.0.6 /usr/local/tomcat
4.安装tomcat-connectors
tar zxvf tomcat-connectors-1.2.31-src.tar.gz
cd tomcat-connectors-1.2.31-src/native/
./configure --with-apxs=/usr/local/apache2/bin/apxs --with-java-home=/usr/local/jdk
make && make install
5. 配置httpd.conf 文件
vi /usr/local/apache2/conf/httpd.conf
添加
LoadMole jk_mole moles/mod_jk.so
<IfMole jk_mole>
JkWorkersFile conf/workers.properties
JkMountFile conf/uriworkermap.properties
JkLogFile logs/mod_jk.log
JkLogLevel warn
</IfMole>
6.创建并配置workers.properties文件
vi /usr/local/apache2/conf/workers.properties
worker.list=wlb , jkstatus
worker.ajp13w.type=ajp13
worker.ajp13w.host=localhost
worker.ajp13w.port=8009
worker.wlb.type=lb
worker.wlb.balance_workers=ajp13w
worker.jkstatus.type=status
7.创建并配置uriworkermap.properties
vi /usr/local/apache2/conf/uriworkermap.properties
/admin/*=wlb
/manager/*=wlb
/jsp-examples/*=wlb
/servlets-examples/*=wlb
/examples/*=wlb
/*.jsp=wlb
!/servlets-examples/*.jpeg=wlb
/jkmanager=jkstatus
8.编辑server.xml文件
vi /usr/local/tomcat/conf/server.xml
在这个位置修改
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="/usr/local/apache2/htdocs" debug="0"/>
9.在/usr/local/apache2/htdocs下创建测试文件test.jsp
vi /usr/local/apache2/htdocs/test.jsp
<%
System.out.println( "Evaluating date now" );
java.util.Date date = new java.util.Date();
%>
Hello! The time is now <%= date %>
10.启动tomcat 和httpd 服务
[root@www src]# /usr/local/tomcat/bin/startup.sh
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/local/jre
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
/usr/local/apache2/bin/apachectl restart
11.测试
访问http://192.168.15.124/test.jsp 时输出
Hello! The time is now Sun Jan 30 13:55:23 CST 2011
http://192.168.15.124/jkmanager 可以查看状态
JK Status Manager for 192.168.15.124:80追问能加你的qq吗?