tomcat +apache安装
传jdk包
安装jdk:
rpm -ivh jdk-8u20-linux-x64.rpm
添加环境变量:
vi /etc/profile
######java use####
export JAVA_HOME=/usr/java/jdk1.8.0_20
export JAVA_BIN=/usr/java/jdk1.8.0_20/bin
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
验证是否安装成功:
source /etc/profile
java –version
安装Tomcat服务:
Cd ~
拖包
Tar zxf 解压包
# mv apache-tomcat-6.0.43/ /usr/local/tomcat
# cd /usr/local/tomcat/bin/
启动tomcat服务
# ./startup.sh
测试:写自己IP加端口8080
在Apache服务器上安装mod_jk模块:
Yum -y install httpd httpd-devel gcc gcc-c++
Cd ~
拖包
# tar zxf jakarta-tomcat-connectors-1.2.15-src.tar.gz
LL 查看
# cd jakarta-tomcat-connectors-1.2.15-src/jk/native/
# ./configure --with-apxs=/usr/sbin/apxs
# make && make install
ll /etc/httpd/modules/mod_jk.so
Pwd
Cd ..
Ls
Cd conf/
# cp workers.properties /etc/httpd/conf
vim /etc/httpd/conf/workers.properties(进去把所有的都删除在添加四行)
worker.list=worker1
worker.worker1.type=ajp13
worker.worker1.host=172.18.31.3(如果用的是同一台服务器直接写localhost即可)
worker.worker1.port=8009
修改Apache配置文件
# vim /etc/httpd/conf/httpd.conf
LoadModule jk_module modules/mod_jk.so
JkWorkersFile /etc/httpd/conf/workers.properties
JkMount /*.jsp worker1
重新启动apache:
service httpd restart
测试:写自己IP加index.jsp
shell apache+tomcat动静分离
最新推荐文章于 2024-08-15 08:31:40 发布