由于种种原因,resin有时会遇到resin down机的情况,比如:java.lang.OutOfMemoryError。这样的问题如果从代码角度来解决问题,也不是一时半会能解决的,应急解决方案是启用resin-pro的ping功能。
<resin:if test=”${isResinProfessional}”>
<ping>
<url>http://localhost:8080/ping.jsp</url>
<sleep-time>1m</sleep-time>
<try-count>5</try-count>
<socket-timeout>30s</socket-timeout>
</ping>
</resin:if>
ping.jsp可随意写一些代码,纯html代码也行,只能服务器能响应返回200。
如果访问resin访问http://localhost:8080/ping.jsp返回不是200 code,然后再重试try-count次,如果依然不响应200,则将自动重启resin服务。
如果在resin tag下配置了:
<system-property mail.smtp.host=”127.0.0.1″/>
<system-property mail.smtp.port=”25″/>
还可以让resin自动给你发个邮件通知你它自动重启过了:
<ping resin:type=”com.caucho.server.admin.PingMailer”>
<url>http://localhost:8080/ping.jsp</url>
<mail-to>fred@hogwarts.com</mail-to>
<mail-from>resin@hogwarts.com</mail-from>
<mail-subject>Resin ping has failed for server ${’${’}server.name}</mail-subject>
</ping>
这样配置好了,不管resin出现什么故障,只要resin进程不死,就可以放心睡大觉了。
如果还启用了resin的session持久化存储,用户基本感觉不到服务已经重启过了。
如果启用了resin的cluster,那么请修改httpd.sh,将-server参数加上,不然重启resin后是没有cluster的。
当然,这此功能都是resin-pro版提供的,免费版不支持ping,也不支持session持久、cluster。我已经破解了resin-pro版,可放心启用这些功能,并且将及时破解resin发布的最新pro版本。
关于resin破解,请查看<<破解resin-pro-3.1>>
1月 20th, 2008 in
技术 |
1 Comment
网页标题的写法还需要专门讨论?
满足下列条件就需要:
1、当你的网页编码是UTF-8
2、标题是中文
如果1和2都满足,必须要将标题放在编码定义的下面,不然IE显示一片空白,而FireFox下没问题。
下面的写法在IE中显示一片空白,FireFox下正常:
<title>意见反馈 — 网络收藏夹 在线密码管理 自动登录所有网站–豌豆网(onedoor)</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″ />
这种写法才是正确的写法:
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″ />
<title>意见反馈 — 网络收藏夹 在线密码管理 自动登录所有网站–豌豆网(onedoor)</title>
没想到IE是如此的“不聪明”,而在做网页时最好按照规范来做。
或许,使用工具写html也是一个不错的主意…
1月 15th, 2008 in
技术 |
No Comments
在windows下正常运行,并能正确发送邮件的代码,移植到linux(ubuntu 7.1)下却出现了问题:
java.lang.NullPointerException
at java.lang.String.concat(String.java:1827)
at com.sun.activation.registries.MailcapFile.parseLine(MailcapFile.java:235)
at com.sun.activation.registries.MailcapFile.parse(MailcapFile.java:197)
at com.sun.activation.registries.MailcapFile.createMailcapHash(MailcapFile.java:157)
at com.sun.activation.registries.MailcapFile.<init>(MailcapFile.java:40)
at javax.activation.MailcapCommandMap.loadFile(MailcapCommandMap.java:276)
at javax.activation.MailcapCommandMap.<init>(MailcapCommandMap.java:128)
at javax.activation.CommandMap.getDefaultCommandMap(CommandMap.java:44)
at javax.activation.DataHandler.getCommandMap(DataHandler.java:136)
at javax.activation.DataHandler.getDataContentHandler(DataHandler.java:568)
at javax.activation.DataHandler.getContent(DataHandler.java:501)
at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1253)
at javax.mail.internet.MimeMessage.updateHeaders(MimeMessage.java:2012)
at javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:1980)
at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:381)
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:326)
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:322)
at com.nes.util.OneDoorMailSender$MailSender.run(OneDoorMailSender.java:310)
at java.lang.Thread.run(Thread.java:595)
经查看java doc(http://java.sun.com/products/javabeans/glasgow/javadocs/javax/
activation/MailcapCommandMap.html)发现,在用户的根目录下有个隐藏的.mailcap文件:
-e
# Java Web Start
application/x-java-jnlp-file; /usr/local/java/jre/bin/javaws %s
原来最前面有个-e的东东,与java doc描述不符,注释掉这行,然后发送邮件成功。
附:
mailcap 文件搜索顺序:
MailcapCommandMap 在用户系统的各个位置查找 mailcap 文件条目。当发出请求以搜索 MailcapCommandMap 中的命令时,它以下面的顺序搜索 mailcap 文件:
- 以编程方式添加到 MailcapCommandMap 实例的条目。
- 用户主目录中的
.mailcap 文件。
- <java.home>
/lib/mailcap 文件。
- 名为
META-INF/mailcap 的文件或资源。
- 名为
META-INF/mailcap.default 的文件或资源(通常只存在于 activation.jar 文件中)。
mailcap 文件格式:
# 注释以 '#' 开头并延续到行的末尾。
<mime type>; ; <parameter list>
# 其中参数列表由一个或多个参数组成,
# 其中参数类似于:x-java-view=com.sun.TextViewer
# 参数列表类似于:
纯文本; ; x-java-view=com.sun.TextViewer; x-java-edit=com.sun.TextEdit
# 注意,不包含 ‘x-java’ 参数的 mailcap 条目
# 和遵守 RFC 1524 的条目将被忽略:
image/gif; /usr/dt/bin/sdtimage %s
1月 7th, 2008 in
技术 |
2 Comments
#vi /etc/syslog.conf
加入以下行:
local7.* /var/log/firewall/firewall.log
然后按照网上前人的经验,将/etc/init.d/sysklogd中的
SYSLOGD=”"
修改为:
SYSLOGD=”r”
再重启syslog:
/etc/init.d/sysklogd restart
发现514端口没打开。
再修改:
#vi /etc/default/syslogd
SYSLOGD=”"
修改为:
SYSLOGD=”-r”
#tail /var/log/messages
出现:
Jan 5 00:35:05 dingl-ubuntu syslogd 1.4.1#21ubuntu3: restart (remote reception).
说明syslog可接收外部日志了。
配置防火墙可从514端口接收外部日志:
/sbin/iptables -A INPUT -p udp –dport 514 -j ACCEPT
重启防火墙。
在远程设备上设置将日志发送到syslog服务器。
#tail /var/log/firewall/firewall.log
成功发现日志,配置成功。
1月 5th, 2008 in
技术 |
1 Comment
在网上查看了很多关于resin性能的文章,比较公认的说法是resin比tomcat的性能要高很多。
但最近在csdn上看了一篇文章,说resin 3.x的免费版与tomcat性能已经不相上下了。原因有两个:
1、tomcat从5.0后就开始在性能上不断改进,以达到生产环境的要求;
2、resin从3.0开始分为免费版与pro版,更多的性能改进被放到了pro版中了,所以免费版的性能就下降了。
基于这样的一些原因,更由于resin的pro版支持session持久化存储、负载均衡及cache等高端特性,于是对破解resin pro版产生了兴趣。
经过N个夜晚的奋战,终于把这个pro版给破解了。
网上也有人说破解得不好的resin pro版可能会使性能下降,个人感觉不存在这样的问题,只要破解了即可享用pro版的各种特性,性能也有大幅提高。
以下的resin启动的部分输出:
Resin Professional 3.1.4 (built Tue, 04 Dec 2007 11:27:12 PST)
Copyright(c) 1998-2007 Caucho Technology. All rights reserved.
Starting Resin on Mon, 31 Dec 2007 17:18:52 +0800 (CST)
[17:18:53.640] {main} Proxy Cache disk-size=1024M memory-size=64M
[17:18:53.656] {main} PingThread[] starting, checking []
[17:18:54.109] {main}
[17:18:54.234] {main} Windows XP 5.1 x86
[17:18:54.343] {main} Java 1.5.0_11-b03, 32, mixed mode, GBK, zh, Sun Microsystems Inc.
[17:18:54.468] {main} user.name: dingl
[17:18:54.593] {main} resin.home = C:\resin-pro-3.1.4
[17:18:54.718] {main} resin.root = C:\resin-pro-3.1.4
[17:18:54.828] {main} resin.conf = /D:/workspace/project/resin-3.1.conf
[17:18:54.828] {main}
[17:18:55.734] {main} WebApp[http://localhost:80] Set web app root system property: ‘webapp.root’ = [D:\workspace\project\WebContent\]
[17:18:59.515] {main} WebApp[http://localhost:80] active
[17:19:00.171] {main} WebApp[http://localhost:80/resin-doc] active
[17:19:00.390] {main} WebApp[http://localhost:80/resin-admin] active
[17:19:00.500] {main} Host[] active
[17:19:00.640] {main} Socket JNI library is not available.
[17:19:00.640] {main} Resin will still run but performance will be slower.
[17:19:00.640] {main} To compile the Socket JNI library on Unix, use ./configure; make; make install.
[17:19:00.796] {main} hmux listening to localhost:6800
[17:19:00.921] {main} http listening to *:80
[17:19:01.140] {main} Server[id=,cluster=app-tier] active
[17:19:01.281] {main} Resin started in 9547ms
可以看到已经没有关于license的提示了,并且增加了Proxy Cache disk-size=1024M memory-size=64M的输出,说明已经使用了cache来提高性能。
值得一提的是,要想获得更好的性能,请使用linux/unix系统,因为在windows下,默认安装的resin是不能使用JNI库的,需要手工编译。而在linux/unix下,make源码后就已经将JNI库编译好了。这个特性可以从输出中看出来:
[17:19:00.640] {main} Socket JNI library is not available.
[17:19:00.640] {main} Resin will still run but performance will be slower.
linux/unix系统中没有这样的提示。
目前本blog提供resin-pro-3.1.3版的下载,地址为:
resin-pro-3.1.3 for windows 下载
resin-pro-3.1.3 for linux/unix 下载
resin-pro-3.1.4由于目前标记为dev,暂不破解此版本。3.1.5目前正在开发,尚未发布,目前已经可以看到3.1.5的change log了。
12月 31st, 2007 in
技术 |
3 Comments
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明。
http://www.dingl.com/blog/archives/19
作者:丁令
作为服务器对外提供服务,不能不安装防火墙,这部分为Ubuntu7.1配置iptables。
在网上查看了很多关于Ubuntu下防火墙配置的文章,感觉都很麻烦。
在desktop版下,可以使用firestarter来配置iptables。
在server中也有shorewall工具来配置。
仔细研究了一下iptables的配置,发现都是使用iptables命令来配置规则,同时发现网上有朋友直接使用脚本配置规则。于是,依样画葫芦也搞了个脚本,这样省事,而且与Fedora Core命令行下的配置类似。
创建/etc/init.d/firewall文件:
vi /etc/init.d/firewall
放到/etc/init.d下的原因是方便自动启动。
脚本如下:
#!/bin/bash
# This program is used to use start my iptables.
#History :
# Sat Jun 17 23:22:01 CST 2006 Jerry Second realease
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:~/bin
export PATH
case “$1″ in
start)
echo -n “Staring FireWall … ”
# /sbin/iptables -P INPUT DROP
/sbin/iptables -P OUTPUT ACCEPT
/sbin/iptables -A INPUT -i lo -j ACCEPT
/sbin/iptables -A INPUT -p icmp -m icmp –icmp-type 8 -j ACCEPT
/sbin/iptables -A INPUT -p tcp -m tcp –dport 22 -j ACCEPT
/sbin/iptables -A INPUT -p tcp -m tcp –dport 80 -j ACCEPT
/sbin/iptables -A INPUT -p all -m state –state ESTABLISHED,RELATED -j ACCEPT
/sbin/iptables -A INPUT -p all -m state –state INVALID,NEW -j DROP
echo “OK”
;;
stop)
echo -n “Stop FireWall … ”
/sbin/iptables -F
/sbin/iptables -X
/sbin/iptables -Z
echo “OK”
;;
restart)
/etc/init.d/firewall stop
/etc/init.d/firewall start
echo “Restart FireWall OK”
;;
*)
echo “Usage: $0 {start|stop|restart}”
esac
exit 0
如果想新开端口,直接修改start部分即可。
测试firewall是否能正常工作:
/etc/init.d/firewall restart
没有问题。
配置firewall随系统自动启动:
cd /etc/init.d
update-rc.d firewall defaults 01
01表示启动优先级,让系统刚启动时就立即启动防火墙规则,可修改所有的K01为K99,在关机或重启服务器时最后停止防火墙服务。
至此,本系统文章全部完毕。
作为生产环境,以上配置基本足够了,能跑目前流行的各种应用,包括N多的开源或免费的应用,如BBS、CMS、Blog等。
Ubuntu 7.1 server从无到有搭建全能WEB生产环境(一)
Ubuntu 7.1 server从无到有搭建全能WEB生产环境(二)
Ubuntu 7.1 server从无到有搭建全能WEB生产环境(三)
Ubuntu 7.1 server从无到有搭建全能WEB生产环境(四)
Ubuntu 7.1 server从无到有搭建全能WEB生产环境(五)
Ubuntu 7.1 server从无到有搭建全能WEB生产环境(六)
Ubuntu 7.1 server从无到有搭建全能WEB生产环境(七)
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明。
http://www.dingl.com/blog/archives/19
作者:丁令
12月 3rd, 2007 in
技术 |
3 Comments
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明。
http://www.dingl.com/blog/archives/18
作者:丁令
作为生产环境,经常需要使用SSL来支持https协议,这部分主要为Apache增加SSL支持。
六、配置apache支持ssl:
1、修改Apache配置文件:
vi /usr/local/apache/conf/httpd.conf
确保两面这行没有被注释:
LoadModule ssl_module modules/mod_ssl.so
Include conf/extra/httpd-ssl.conf
再配置一个虚拟主机(可配置成xxx.dingl.com,根据购买的SSL证书设置):
<VirtualHost *:80>
ServerName www.dingl.com
DocumentRoot /home/dingl/jsp-web
ResinConfigServer localhost 6800
AddHandler caucho-request jsp
AddHandler caucho-request xtp
AddHandler caucho-request vm
</VirtualHost>
2、修改ssl配置文件:
vi /usr/local/apache/conf/extra/httpd-ssl.conf
dingl.com修改成如下形式:
Listen 443
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl .crl
SSLPassPhraseDialog builtin
SSLSessionCache “shmcb:/usr/local/apache/logs/ssl_scache(512000)”
SSLSessionCacheTimeout 300
SSLMutex “file:/usr/local/apache/logs/ssl_mutex”
##
## SSL Virtual Host Context
##
<VirtualHost _default_:443>
# General setup for the virtual host
DocumentRoot “/home/dingl/jsp-web”
ServerName www.dingl.com:443
ServerAdmin you@example.com
ErrorLog “/usr/local/apache/logs/error_log”
TransferLog “/usr/local/apache/logs/access_log”
# SSL Engine Switch:
# Enable/Disable SSL for this virtual host.
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
SSLCertificateFile “/usr/local/apache/conf/dingl.com.crt”
#SSLCertificateFile “/usr/local/apache/conf/server-dsa.crt”
SSLCertificateKeyFile “/usr/local/apache/conf/dingl.com.key”
#SSLCertificateKeyFile “/usr/local/apache/conf/server-dsa.key”
#SSLCertificateChainFile “/usr/local/apache/conf/server-ca.crt”
#SSLCACertificatePath “/usr/local/apache/conf/ssl.crt”
#SSLCACertificateFile “/usr/local/apache/conf/ssl.crt/ca-bundle.crt”
#SSLCARevocationPath “/usr/local/apache/conf/ssl.crl”
#SSLCARevocationFile “/usr/local/apache/conf/ssl.crl/ca-bundle.crl”
#SSLVerifyClient require
#SSLVerifyDepth 10
ResinConfigServer 127.0.0.1 6800
AddHandler caucho-request jsp
AddHandler caucho-request xtp
AddHandler caucho-request vm
<FilesMatch “\.(cgi|shtml|phtml|php)$”>
SSLOptions +StdEnvVars
</FilesMatch>
<Directory “/usr/local/apache/cgi-bin”>
SSLOptions +StdEnvVars
</Directory>
BrowserMatch “.*MSIE.*” \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
CustomLog “/usr/local/apache/logs/ssl_request_log” \
“%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \”%r\” %b”
</VirtualHost>
这时即可通过http://www.dingl.com/访问了。
Ubuntu 7.1 server从无到有搭建全能WEB生产环境(一)
Ubuntu 7.1 server从无到有搭建全能WEB生产环境(二)
Ubuntu 7.1 server从无到有搭建全能WEB生产环境(三)
Ubuntu 7.1 server从无到有搭建全能WEB生产环境(四)
Ubuntu 7.1 server从无到有搭建全能WEB生产环境(五)
Ubuntu 7.1 server从无到有搭建全能WEB生产环境(六)
Ubuntu 7.1 server从无到有搭建全能WEB生产环境(七)
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明。
http://www.dingl.com/blog/archives/18
作者:丁令
12月 3rd, 2007 in
技术 |
No Comments
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明。
http://www.dingl.com/blog/archives/17
作者:丁令
五、安装Rails环境
Rails环境使用Mongrel架设。
1、安装ruby
tar -zxvf ruby-1.8.6.tar.gz
cd ruby-1.8.6
./configure –prefix=/usr/local/ruby
make
make install
将ruby加入PATH
vi /etc/profile
RUBY_HOME=/usr/local/ruby
PATH=”${RUBY_HOME}”/bin:”${JAVA_HOME}”/bin:/usr/local/mysql/bin:”${PATH}”
export PATH
退出root,重新用root登陆,验证ruby是否安装成功
ruby -v
显示版本号,说明安装成功
2、安装gem
tar -zxvf rubygems-0.9.4.tgz
cd rubygems-0.9.4
ruby setup.rb
rubygems-0.9.5好像有问题,无论gem什么包都说ssl没有安装,重新安装个rubygems-0.9.4就没问题了。
3、安装rails/mongrel/termios
apt-get install libssl-dev
gem install rake –include-dependencies
gem install rails –include-dependencies
gem install termios –include-dependencies
gem install mongrel –include-dependencies
gem install mongrel_cluster –include-dependencies
生成一个默认站点(或者将已经开发的网站上传,并配置好数据库)后,转到站点目录
mongrel_rails cluster::configure -e production -p 8000 -N 3 -c /home/dingl/rails-web/ -a 127.0.0.1
在database.yml中配置好数据库,这里是生产环境,配置production段。
如果需要使用socket方式连接mysql,增加:
socket: /tmp/mysql.sock
同时还可以指定数据传输编码:
encoding: utf8
4、启动mongrel:
mongrel_rails cluster::start
如果出现以下错误:
Cannot find gem for Rails ~>1.2.3.0:
Install the missing gem with ‘gem install -v=1.2.3 rails’
则修改config/environment.rb里rails的版本号即可
5、配置Apache与Mongrel:
修改apache的配置文件:
vi /usr/local/apache/conf/httpd.conf
在文件最后增加一个虚拟主机:
<VirtualHost *:80>
ServerName http://www.dingl.com/
RewriteEngine On
DocumentRoot /home/dingl/rails-web/
ProxyRequests Off
<Proxy balancer://mongrel_cluster>
BalancerMember http://127.0.0.1:8000/
BalancerMember http://127.0.0.1:8001/
BalancerMember http://127.0.0.1:8002/
</Proxy>
ProxyPass balancer://mongrel_cluster/images !
ProxyPass balancer://mongrel_cluster/stylesheets !
ProxyPass balancer://mongrel_cluster/javascrits !
ProxyPass / balancer://mongrel_cluster/
ProxyPassReverse / balancer://mongrel_cluster/
ProxyPreserveHost on
</VirtualHost>
重启Mongrel_cluster和Apache,然后在IE中打开http://www.dingl.com/就可以正常访问了。
注意,这里不能使用http://www.dingl.com:8000等直接访问,因为Mongrel配置为127.0.0.1,只能使用http://127.0.0.1:8000访问。
6、将mongrel设为随系统一同启动:
ln -s /home/dingl/rails-web/config/mongrel_cluster.yml /etc/mongrel_cluster/app.yml
cp /usr/local/ruby/lib/ruby/gems/1.8/gems/mongrel_cluster-1.0.5/resources/mongrel_cluster /etc/init.d/mongrel_cluster
cd /etc/init.d
chmod +x mongrel_cluster
vi /etc/init.d/mongrel_cluster
在CONF_DIR之上加入一行:
PATH=/usr/local/ruby/bin:/usr/local/ruby/lib/ruby/gems/1.8/gems/mongrel_cluster-1.0.5/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local:/usr/local/sbin:/usr/local/bin
这里要写完整的路径,不要引入另外一个变量
下面的USER=mongrel一行可根据需要设置一个用来启动的用户,如果没有创建mongrel用户,可修改为USER=root
update-rc.d -f mongrel_cluster defaults
重启服务器后,能正常使用http://www.dingl.com/访问Rails应用了。
Ubuntu 7.1 server从无到有搭建全能WEB生产环境(一)
Ubuntu 7.1 server从无到有搭建全能WEB生产环境(二)
Ubuntu 7.1 server从无到有搭建全能WEB生产环境(三)
Ubuntu 7.1 server从无到有搭建全能WEB生产环境(四)
Ubuntu 7.1 server从无到有搭建全能WEB生产环境(五)
Ubuntu 7.1 server从无到有搭建全能WEB生产环境(六)
Ubuntu 7.1 server从无到有搭建全能WEB生产环境(七)
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明。
http://www.dingl.com/blog/archives/17
作者:丁令
12月 3rd, 2007 in
技术 |
1 Comment
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明。
http://www.dingl.com/blog/archives/16
作者:丁令
四、JAVA环境的安装
JSP容器我推荐使用Resin,一是作为生产环境Resin比Tomcat更加优秀,二是我对Resin比较熟,使用已经有6年之久。
当然,也可以同时安装Resin和Tomcat与Apache一起使用。此次安装同时也安装了Tomcat,不过没有与Apache结合,直接使用非80端口提供服务。鉴于Tomcat安装更加简单,此系列文章不包含Tomcat的安装。
1、安装jdk
chmod 755 jdk-1_5_0_11-linux-i586.bin
./jdk-1_5_0_11-linux-i586.bin
cp -r jdk1.5.0_11 /usr/local/java
2、修改环境变量:
vi /etc/profile
在最后加上:
JAVA_HOME=/usr/local/java
export JAVA_HOME
PATH=”${JAVA_HOME}”/bin:/usr/local/mysql/bin:”${PATH}”
export PATH
3、安装resin:
tar -zxvf resin-pro-3.1.3.tar.gz
cd resin-pro-3.1.3
./configure –with-apache=/usr/local/apache
make
make install
cp -r /home/dingl/soft/resin-pro-3.1.3 /usr/local/resin
cd /usr/local/resin
4、修改环境变量:
vi /etc/profile
JRE_HOME=”${JAVA_HOME}”/jre
export JRE_HOME
CLASSPATH=.:”${JAVA_HOME}”/lib/tools.jar:”${JAVA_HOME}”/lib/dt.jar
export CLASSPATH
RESIN_HOME=/usr/local/resin
export RESIN_HOME
CLASSPATH=”${RESIN_HOME}”/lib/resin.jar:”${CLASSPATH}
export CLASSPATH
PATH=”${JAVA_HOME}”/bin:/usr/local/mysql/bin:”${PATH}”
export PATH
5、配置resin启动环境:
退出重新用root登陆ssh
vi /usr/local/resin/bin/httpd.sh
修改
exec $java -jar ${RESIN_HOME}/resin.jar $*
为
exec $java -jar ${RESIN_HOME}/lib/resin.jar $*
并在此行上面加:
JAVA_HOME=/usr/local/java
export JAVA_HOME
RESIN_HOME=/usr/local/resin
export RESIN_HOME
PATH=${JAVA_HOME}/bin:${PATH}
export PATH
6、测试resin:
/usr/local/resin/bin/httpd.sh
如果能正常打开http://www.dingl.com:8080/ 则说明resin安装成功
vi /usr/local/resin/conf/resin.conf
修改
<web-app id=”/” root-directory=”webapps/ROOT”/>
为
<web-app id=”/” root-directory=”/home/dingl/jsp-web/test/”/>
在/home/dingl/jsp-web/test/下新建一个index.jsp文件,内容如下:
2+2=<%=2+2%>
7、结合Apache和Resin:
vi /usr/local/apache/conf/httpd.conf
将DocumentRoot “/home/dingl/php-web/test”修改为DocumentRoot “/home/dingl/jsp-web/test”
再加上以下一段:
<Directory “/home/dingl/jsp-web/test”>
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
增加welcome文件列表,修改
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
为
<IfModule dir_module>
DirectoryIndex index.html index.jsp index.php index.htm
</IfModule>
重启resin及apache(注意一个重启顺序,先Resin再Apache):
/usr/local/resin/bin/httpd.sh restart
/usr/local/apache/bin/apachectl -k restart
分别访问:
http://www.dingl.com:8080/index.jsp
http://www.dingl.com/index.jsp
浏览器显示2+2=4说明apache与resin整合成功
8、让resin随系统一起启动
resin在Ubuntun下的自启动按照官方文档是不行的,但是fedora core下是可以的。具体如下:
cp /usr/local/resin/bin/httpd.sh /usr/local/resin/bin/resin-a.sh
然后测试使用resin-a.sh是否能正常启动并停止服务:
/usr/local/resin/bin/resin-a.sh start
/usr/local/resin/bin/resin-a.sh stop
如果不行,则路径配置有误。
cp /usr/local/resin/bin/resin-a.sh /etc/init.d/resin
cd /etc/init.d
update-rc.d resin defaults
重启服务器即可看到Apache与Resin同时启动了,使用http://www.dingl.com/即可正常访问!
Ubuntu 7.1 server从无到有搭建全能WEB生产环境(一)
Ubuntu 7.1 server从无到有搭建全能WEB生产环境(二)
Ubuntu 7.1 server从无到有搭建全能WEB生产环境(三)
Ubuntu 7.1 server从无到有搭建全能WEB生产环境(四)
Ubuntu 7.1 server从无到有搭建全能WEB生产环境(五)
Ubuntu 7.1 server从无到有搭建全能WEB生产环境(六)
Ubuntu 7.1 server从无到有搭建全能WEB生产环境(七)
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明。
http://www.dingl.com/blog/archives/16
作者:丁令
12月 3rd, 2007 in
技术 |
1 Comment