Apache+Tomcat+JspRun论坛搭建
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
[*]#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
[*]# 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
[*]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
[*]
[*]info=Ajp13 forwarding over socket
[*]tomcatId=localhost:8009
[*]# Map the Tomcat examples webapp to the Web server uri space
[*]
[*]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、启动服务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下
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
注释掉默认的
#
# 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
#
#
# 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
#
新建如下:
[*]
[*] Order allow,deny
[*] Allow from all
[*]
[*]
[*] 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
[*]
4、tomcat配置
找到如下一段:
在下面添加一行:定义主目录与apache相同
5、浏览器打开
http://127.0.0.1/install.jsp
或http://127.0.0.1:8080/install.jsp
按步骤完成安装………….
页:
[1]