Apache+Tomcat+JspRun论坛搭建
一、 所需安装包
httpd-2.2.11.tar.gz
apache-tomcat-6.0.18.tar.gz
jdk-6u10-linux-i586.tar.gz
jakarta-tomcat-connectors-jk2-src-current.tar.gz
二、 安装所用包
###install Compile Environment###
for i in gcc gcc-c++ flex bison autoconf automake bzip2-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel ; do yum install -y $i ;done
1、 apache
#tar xvf httpd-2.2.11.tar.gz
#cd http-2.2.11
#./configure –prefix=/usr/local/apache2 –enable-so
#make
#make install
2、 tomcat
#tar xvf apache-tomcat-6.0.18.tar.gz –C /usr/local
#cd /usr/local
#ln –s apache-tomcat-6.0.18 tomcat
3、 jdk<java运行环境>
#mkdir /usr/java
#cp jdk-6u10-linux-i586.tar.gz /usr/java
#cd /usr/java
#tar xvf jdk-6u10-linux-i586.tar.gz
#vi /etc/profile
最后添加:
export JAVA_HOME=/usr/java/jdk
export CLASSPATH=$JAVA_HOME/lib
export PATH=$JAVA_HOME/bin:$PATH
export PATH JAVA_HOME CLASSPATH
#source /etc/profile
4、编译生成mod_jk<连接apache与tomcat>
# tar xzvf jakarta-tomcat-connectors-jk2-src-current.tar.gz
# cd jakarta-tomcat-connectors-jk2-2.0.4-src/jk/native2
# ./configure ——with-apxs2=/usr/local/apache2/bin/apxs
# make
# cd ../build/jk2/apache2/
# /usr/local/apache2/bin/apxs -n jk2 -i mod_jk2.so
/usr/local/apache2/build/instdso.sh SH_LIBTOOL='/usr/local /apache2/build/libtool' mod_jk2.so /usr/local/apache2/modules
/usr/local/apache2/build/libtool --mode=install cp mod_jk2.so /usr/local/apache2/modules/
cp mod_jk2.so /usr/local/apache2/modules/mod_jk2.so
Warning! dlname not found in /usr/local/apache2/modules/mod_jk2.so.
Assuming installing a .so rather than a libtool archive.
5、在/usr/local/apache2/conf/下面建立两个配置文件mod_jk2.conf和workers2.properties
# vi mod_jk2.conf
添加以下内容:
# 指出mod_jk模块工作所需要的工作文件workers2.properties的位置
JkWorkersFile /usr/local/apache2/conf/workers2.properties
# Where to put jk logs
JkLogFile /usr/local/apache2/logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
# 将所有servlet 和jsp请求通过ajp13的协议送给Tomcat,让Tomcat来处理
JkMount /servlet/* worker1
JkMount /*.jsp worker1
# vi workers2.properties
# Define the communication channel
[channel.socket:localhost:8009]
info=Ajp13 forwarding over socket
tomcatId=localhost:8009
# Map the Tomcat examples webapp to the Web server uri space
[uri:/*.jsp]
info=Map the whole webapp
6、修改apache配置文件
最后添加
LoadModule jk2_module modules/mod_jk2.so
7、配置tomcat启动脚本
vi /usr/local/tomcat/bin/catalina.sh
在第二行加入以下内容:
# chkconfig: 345 88 14
# description: Tomcat Daemon
# processname: tomcat
JAVA_HOME=/usr/java/jdk
CATALINA_HOME=/usr/local/tomcat
然后保存退出。
#cp catalina.sh /etc/rc.d/init.d/tomcat
#chmod 755 /etc/rc.d/init.d/tomcat
#chkconfig --add tomcat
#chkconfig --list tomcat
tomcat 0ff 1ff 2n 3n 4n 5n 6ff
8、配置apache启动脚本
#cp /usr/local/httpd/bin/apachectl /etc/rc.d/init.d/httpd
使用编辑器打开httpd文件,并在第一行#!/bin/sh下增加两行文字如下
# chkconfig: 35 70 30
# description: Apache
接着注册该服务
#chkconfig --add httpd
#chkconfig httpd on
9、启动服务<关闭时顺序也要httpd--->tomcat>
#/etc/init.d/httpd start
#/etc/init.d/tomcat start
测试:http://127.0.0.1 apache
http://127.0.0.1:8080 tomcat
三、搭建jsprun论坛
EasyJspRun!6.0.0_for_linux_UTF8.zip
经过多层解压缩后,把其中的ROOT目录拷贝到/usr/local/tomcat/webapps下<拷贝前需改名为jsprun,因为/usr/local/tomcat/webapp 中已经存在tomcat的默认目录ROOT>
1、Mysql安装部分省略
…………
2、#cd /usr/local/tomcat/webapps/jsprun
#vi config.properties
修改
dbpw = 123456 连接数据库的密码,也可以根据情况修改连接用户,库等
# mysql -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 160
Server version: 5.0.77-log Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> create database jsprun; <此库名即上述配置文件中指定的>
3、配置apache,完成虚拟主机搭建
#vi /usr/local/apache2/conf/httpd.conf
取消 Include conf/extra/httpd-vhosts.conf 前的#号 注释
#vi /usr/local/apache2/extra/httpd-vhosts.conf
注释掉默认的
#<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot "/usr/local/apache2/docs/dummy-host.example.com"
# ServerName dummy-host.example.com
# ServerAlias www.dummy-host.example.com
# ErrorLog "logs/dummy-host.example.com-error_log"
# CustomLog "logs/dummy-host.example.com-access_log" common
#</VirtualHost>
#<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host2.example.com
# DocumentRoot "/usr/local/apache2/docs/dummy-host2.example.com"
# ServerName dummy-host2.example.com
# ErrorLog "logs/dummy-host2.example.com-error_log"
# CustomLog "logs/dummy-host2.example.com-access_log" common
#</VirtualHost>
新建如下:
<Directory /usr/local/tomcat/webapps/jsprun>
Order allow,deny
Allow from all
</Directory>
<VirtualHost *:80>
ServerAdmin abc@163.com
DocumentRoot "/usr/local/tomcat/webapps/jsprun"
ServerName http://192.168.0.201
DirectoryIndex index.html index.jsp
ErrorLog "logs/jsp-error_log"
CustomLog "logs/jsp-access_log" common
</VirtualHost>
4、tomcat配置
找到如下一段:
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
在下面添加一行:定义主目录与apache相同
<Context path="" docBase="/usr/local/tomcat/webapps/jsprun" debug="0"/>
5、浏览器打开
http://127.0.0.1/install.jsp
或http://127.0.0.1:8080/install.jsp
按步骤完成安装………….
©著作权归作者所有:来自51CTO博客作者qiujichun的原创作品,如需转载,请注明出处,否则将追究法律责任
论坛apachetomcat服务