最近公司要配置如下服务器:
正努力配置,调试成功。
硬件环境
fedora core 6
j2sdk-1_4_2_12
httpd-2.0.59
resin-3.0.19
1、查看linux是否已安装 jdk 如果有卸载(java-1.42-gcj-compat )
下载j2sdk-1_4_2_12-linux-i586.bin
#chmod 755 j2sdk-1_4_2_12-linux-i586.bin
#./j2sdk-1_4_2_05-linux-i586.bin
2、java环境设置
#vi /etc/profile
在文档最后面添加
export JAVA_HOME=/usr/local/j2sdk1.4.2_12
export RESIN_HOME=/usr/local/resin-3.0.19
export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:RESIN_HOME/lib
export PATH=$PATH:$JAVA_HOME/bin:RESIN_HOME/bin
#source /etc/profile
3、测试jdk
#java -version
显示版本信息
#javac
#java
有帮助文档出现就说明jdk安装成功了
4、测试resin
# tar zxvf resin-3.0.13.tar.gz
# cd /usr/local/resin-3.0.19
# /usr/local/resin-3.0.19/bin/httpd.sh start
测试:http://localhost:8080
出现Resin® Default Home Page页面就说明rensin运行正常
5、安装openssl
# rpm -ivh openssl097a-0.9.7a-9.i386.rpm
# rpm -ivh openssl-0.9.8b-8.i386.rpm
# rpm -ivh openssl-devel-0.9.8b-8.i386.rpm
5、安装Apache
# tar zxvf httpd-2.0.59.tar.gz
# cd httpd-2.0.59
#./configure --prefix=/usr/local/apache --enable-module=so
# ./configure --prefix=/usr/local/apache --enable-ssl
# make
# make install
启动apache
#/usr/local/apache/bin/apachectl start
测试http://localhost/
出现默认主页就说明apache安装成功
If you can see this, it means that the installation of the Apache web server software on this system was successful. You may now add content to this directory and replace this page.
6、编译resin
# cd /usr/local/resin-3.0.19
#./configure --with-apxs=/usr/local/apache/bin/apxs
# make
# make install
7、修改配置文件
把/usr/local/resin-3.0.19/conf下的rensin.conf文件中的如下设置改成如下
<web-app id="/" document-directory="/usr/local/apache/htdocs"/>
特别注意的是:一定要执行下面这行
修改host
<cluster>
<srun server-id="" host="192.168.1.11" port="6802"/>
</cluster>
其中192.168.1.11为内网IP
在/usr/local/apache/conf下的httpd.conf中添加
<Location /caucho-status>
SetHandler caucho-status
</Location>
8、启动服务
/usr/local/apache/bin/apachectl restart
/usr/local/resin-3.0.19/bin/httpd.sh restart
9、测试
新建test.jsp在apache目录下:htdocs下
<%@page language="java"%>
2+2=<%=2+2%>
浏览器:http://localhost:8080/test.jsp
错误信息:如果apache出现空白:
解决办法:更改文件或者文件夹权限
************************************************************************
应该要注意的:
3.整合Apache和Resin
目的是让Resin的主目录和apache的主目录指向同一个目录,并且配置Resin可以在解析80端口处的JSP网页.
(1)检查文件
# ls /usr/local/apache/modules/mod_caucho.so
如果有,继续
(2)编辑httpd.conf
# vi /usr/local/apache/conf/httpd.conf
找到ResinConfigServer localhost 6802
确信其内容为:
LoadModule caucho_module /usr/local/apache/modules/mod_caucho.so
ResinConfigServer 192.168.1.11 6802 //即改localhost为你的计算机的实际IP
CauchoStatus yes
(3)编辑resin.conf
# vi /usr/local/resin-3.0.19/conf/resin.conf
将<http...>和<srun...>的host改成实际IP:
<http server-id="" host="192.168.1.11" port="8080"/>
...
<srun server-id="" host="192.168.1.11" port="6802" index="1"/>
(4)重启apache和resin
# /usr/local/apache/bin/apachectl restart
# /usr/local/resin-3.0.19/bin/httpd.sh start
如果出现端口被占,无法绑定的情况,则重启系统,# reboot
(5)测试
将test.jsp文件:
2+2=<%=2+2%>
放到目录apache/htdocs中
访问:
http://localhost/test.jsp
如能正常显示2+2=4,则说明成功.
*************************************************************************
错误信息:
httpd: Could not determine the server's fully qualified domain name, using 192.168.1.11 for ServerName
(98)Address already in use: make_sock: could not bind to address [::]:80
no listening sockets available, shutting down
Unable to open logs
解决方法:查找httpd.conf
取消注释:#ServerName www.example.com:80
reboot
重新启动
再进行测试
在htdocs下新建test.html
<html><body>hello</body></html>
http://localhost/test.html
错误信息:
Forbidden
You don't have permission to access /test.html on this server.
Apache/2.0.59 (Unix) mod_ssl/2.0.59 OpenSSL/0.9.8b Server at localhost Port 80
解决:选中改文件修改可执行权限
参考资料:
1:整合Apache2/Resin/MySQL
http://kb.discuz.net/index.php?title=%E6%95%B4%E5%90%88Apache2/Resin/MySQL2:Resin with Apache
http://caucho.rz.klopotek.de/resin-3.1/doc/install-apache.xtp#standalone3:Resin官方中文资料
http://www.unlinux.com/doc/apache/20051027/3269.html4:apache 1.3.26+resin 2.1.4在linux下面的整合安装
http://www.unlinux.com/doc/apache/20051027/2674.html5:apache+resin安装步骤共享
http://www.unlinux.com/doc/apache/20051027/2696.html6:Apache+resin整合
http://blog.sina.com.cn/u/47243df30100023h7:apache+resin的安装步骤
http://publish.it168.com/2005/0918/20050918029501.shtml8:apache学习笔记一(安装apache2+php+resin)
http://chinaunix.net/jh/13/123634.html9: Apache 手册大全
http://w.yi.org/ftp/FAPM/10:
Apache 2.2 官方手册中文版
电信:http://lamp.linux.gov.cn/Apache/ApacheMenu/index.html
网通:http://www.dogdoghome.com/lamp/Apache/ApacheMenu/index.html
11: 架设某大型网站服务器之全部过程
http://blog.chinaunix.net/u/4764/showart_161964.html12:Apache与Resin组合暴露源代码的分析及解决方案
http://bbs.chinaunix.net/viewthread.php?tid=571500&fpage=1&highlight=
13:apache+resin安装步骤共享
http://bbs.chinaunix.net/viewthread.php?tid=1610814:apache+resin+mysql 整和之道
http://bbs.chinaunix.net/viewthread.php?tid=52948415:Resin + Apache 暴露JSP源代码问题的解决方案(二)
http://bbs.chinaunix.net/viewthread.php?tid=71953216:Apache+Resin+MySQL整合的几个要点
http://blog.chinaunix.net/u/13797/showart_160242.html