1、前言 ??apache+resin来做想来大家都比较熟悉了,一般的配置都是很熟悉的了,我查看了一些论坛上的文章,这方便的文章比较多。在这里,我只要写写apache+resin实现独立的虚拟主机和resin自带的负载均衡。
2、系统和环境: redhat9?and?solaris9 httpd-2.50 resin-3.06 pure-ftpd-1.0.17a.tar.gz 3、安装软件:
3.1、安装apache:
#?tar?zxvf?httpd-2.49.tar.gz #?cd?httpd-2.49 #?./configure?–prefix=/usr/local/apache2?–enable-so?–with-mpm=worker #?make #?make?install
3.2、安装resin:
#?tar?zxvf?resin-3.06.tar.gz #?cd?resin03.06 #?./configure?–prefix=/usr/local/resin?–with-apxs=/usr/local/apache2/bin/apxs #?make #?make?install
3.3、安装pureftp
#?tar?zxvf?pure-ftpd-1.0.17a.tar.gz? #?cd?pure-ftpd-1.0.17a #?./configure?–prefix=/usr/local/pureftpd ???–without-inetd?–with-puredb ???–with-cookie?–with-throttling ???–with-ratios?–with-quotas? ???–with-ftpwho?–with-largefile ???–with-welcomemsg #?make #?make?install #?mkdir?/usr/local/pureftpd/etc
4、配置软件:
目的:用apache和resin做基于域名的虚拟主机,启用resin自身的负载均衡的引擎。resin的负载均衡引擎实际上是可以启动多个java响应进程,通过内部机制来进行负载均衡。
4.1、配置apache:
#?vi?/usr/local/apache2/conf/httpd.conf ————————————— ?DirctoryIndex?index.html?index.jsp ?AddDefaultCharset?Off ?User?nobody ?Group?nobody ?NamevirtualHost?211.11.11.11 ?<VirtualHost?211.11.11.11:80>; ????ServerAdmin?peng.zhang@bj.china.com ????DocumentRoot?/data/web/xcity ????ServerName?xcity.chinaunix.com ????ErrorLog?logs/xcity.chinaunix.com-error_log ????CustomLog?logs/xcity.chinaunix.com-access_log?common </VirtualHost>;
<VirtualHost?211.11.11.11:80>; ????ServerAdmin?peng.zhang@bj.china.com ????DocumentRoot?/data/web/sports ????ServerName?sports.chinaunix.com ????ErrorLog?logs/sports.chinaunix.com-error_log ????CustomLog?logs/sports.chinaunix.com-access_log?common </VirtualHost>; …….. …. #?mod_caucho?Resin?Configuration #
LoadModule?caucho_module?/usr/local/apache2/modules/mod_caucho.so
ResinConfigServer?127.0.0.1 —————————————
4.2、配置resin:
#?vi?/usr/local/resin/conf/resin.conf —————————————-
????<cluster>; ??????<srun?id=”a”?host=”127.0.0.1″?port=”6801″?index=”1″/>; ??????<srun?id=”b”?host=”127.0.0.1″?port=”6802″?index=”2″/>; ??????<srun?id=”c”?host=”127.0.0.1″?port=”6803″?index=”3″/>; ??????<srun?id=”d”?host=”127.0.0.1″?port=”6804″?index=”4″/>; ????</cluster>;
—注解: (这里面,我用了系统本身的127.0.0.1,绑定了4个端口做伏在均衡。还可以用不同的ip地址和同一端口,来作。例如: <cluster>; ??????<srun?id=”a”?host=”211.11.11.11″?port=”6802″?index=”1″/>; ??????<srun?id=”b”?host=”211.11.11.12″?port=”6802″?index=”2″/>; ??????<srun?id=”c”?host=”211.11.11.13″?port=”6802″?index=”3″/>; ??????<srun?id=”d”?host=”211.11.11.14″?port=”6802″?index=”4″/>; ????</cluster>; 还有些人,喜欢在apache中设置每一个java进程服务一个虚拟,这里我们不推荐,这样做,就会失去引擎本身的意义。)
<!–?configures?the?default?host,?matching?any?host?name?–>; ????<host?id=’xcity.chinaunix.com’>; ??????<document-directory>;/data/web/xcity</document-directory>; ?????<!–?configures?the?root?web-app?–>; ?????<web-app?id=’/’>; ????????<!–?adds?xsl?to?the?search?path?–>; ????????<class-loader>; ??????????<simple-loader?path=”$host-root/xsl”/>; ?
免责声明: 本文仅代表作者个人观点,与无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
相关资料
推荐阅读
友情链接: Copyright © 2013-2023 页 当前在线:1044人 网站在1天2时22分19秒内访问总人数:290918人 当前 13.94% |