为什么使用apache+resin组合呢,apache解析html和图片速度快,
而resin解析jsp速度快。这就是这个组合的关键所在。
-----------------------------------------
环境:
1.centos5
2.jdk1.6u3
3.resin-3.19 安装目录/usr/local/resin
4.apapche2.2.9 安装目录/usr/local/apache2
5.mysql5 安装目录/usr/local/mysql
6.jdbc:mysql-connector-java-5.0.8
+++++++++++++++++++++++++++++++++++++++++++++++++
〇.安装mysql
# cd /home/xiutuo/software/
# tar -zvxf mysql-5.0.82-linux-i686-icc-glibc23.tar.gz
# mkdir -p /usr/local/mysql (省略也可)
# cp -r mysql-5.0.82-linux-i686-icc-glibc23.tar.gz /usr/local/mysql
# cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
添加mysql用户及用户组
# groupadd mysql
# useradd -g mysql -s /sbin/nologin mysql
修改mysql目录权限
# cd /usr/local/
# chown -R mysql:mysql mysql
# cd /usr/local/mysql
一定要在该路径下,否则不能生成数据库文件并出错!
用户属主和属组的改变非常重要,否则出错,请严格按照此步骤
#
生成mysql系统数据库
# scripts/mysql_install_db --user=mysql
# chown -R mysql:mysql data
启动mysql服务
# /usr/local/mysql/bin/mysqld_safe --user=mysql&
如出现 Starting mysqld daemon with databases from /usr/local/mysql/data
代表正常启动mysql服务了, 按Ctrl + C 跳出
修改 mysql 的 root 密码
# /usr/local/mysql/bin/mysqladmin -u root -p password "123456"
一.安装jdk
1.安装jdk的rpm包
# ./jdk-6u3-linux-i586-rpm.bin
多敲几个空格,然后看到[yes]的时候输入yes,回车
然后在当前目录下就生成了jdk-6u3-linux-i586-rpm
2.设置java和resin相关环境变量和classpath,
(此步骤可以在安装和配置好apache和resin后再做,再启动apache和resin)
# vi /etc/profile
//java
//如果你安装的j2sdk的路径不一样,请自行修改
JAVA_HOME=/usr/java/jdk1.6.0_03
export JAVA_HOME
# 设置java和resin的classpath,重要
CLASSPATH=/usr/java/jdk1.6.0_03/lib:/usr/java/jdk1.6.0_03/jre/lib:/usr/local/resin/lib
export CLASSPATH
PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
export PATH
JRE=/usr/java/jdk1.6.0_03/jre
export JRE
LD_LIBRARY_PATH=/usr/local/apr/lib
export LD_LIBRARY_PATH
# 设置resinhome,重要
RESINHOME=/usr/local/resin
export RESINHOME
3:立即生效
//如果你修改的是/etc/profile
# source /etc/profile
//如果你修改的是~/.cshrc
# source ~/.cshrc
//如果你修改的是~/.bash_profile
# source ~/.bash_profile
二.安装apache
# ./configure --prefix=/usr/local/apache2 /
--enable-modules=so /
--enable-mods-shared=all
# make
# make install
三.整合apache时resin的安装
1,编译安装
# ./configure --prefix=/usr/local/resin /
--with-apache=/usr/local/apache2 /
--with-apxs=/usr/local/apache2/bin/apxs /
--with-java-home=/usr/java/jdk1.6.0_03
# make
# make install
-------------------------------------
resin以standalone方式运行时的安装
# mkdir -p /usr/local/resin/
# mkdir -p /usr/local/resin/licenses
专业版时候需要建立该目录,否则报错
Resin Professional has not found any valid licenses.
# ./configure --prefix=/usr/local/resin
# make
# make install
# cd /usr/local/resin/lib
# java -jar resin.jar
# 或者运行/usr/local/resin/bin/httpd.sh
---------------------------------------
编译安装apache和resin后,他们就完成了整合,不需要修改任何配置。
查看整合后的文件http.conf中多了以下几行:
LoadModule caucho_module /usr/local/apache2/modules/mod_caucho.so
ResinConfigServer localhost 6800
CauchoConfigCacheDirectory /tmp
其中 6800是resin和apache内部通信端口。
先启动resin
# /usr/resin/bin/http.sh start
可以通过http://ip:8080/访问
再启动apache
# /usr/local/apache2/bin/apachectl start
可以通过http://ip/访问