一.Apache安装
1.安装
进入apache安装目录,编辑/server/mpm/worker/worker.c文件,修改参数为#define DEFAULT_SERVER_LIMIT 2560和# define DEFAULT_THREAD_LIMIT 500
创建apache目录
# ./configure --prefix=/usr/local/apache --with-mpm=worker --enable-so
# make
# make install
#make clean
2.配置
cd /usr/local/apache/conf
vi httpd.conf
参数修改如下
<IfModule worker.c>
StartServers 50 //共启动多少个子流程服务
ServerLimit 200
MaxClients 2000 //最大连接数
MinSpareThreads 25 //最小空闲线程数
MaxSpareThreads 75 //最大空闲线程数
ThreadsPerChild 40 //每个子流程中的线程数
MaxRequestsPerChild 20000 //每个子流程最多处理的请求数
<IfModule>
加入如下内容,防止对.conf配置文件访问
<Files ~.conf>
Order allow,deny
Deny from all
</Files>
去掉<Directory>……</Directory>之间的Indexes选项,以防止对文件列表的访问
二、Resin安装
1.安装jdk
设置环境变量
Vi profile
JAVA_HOME=/usr/local/j2sdk1.4.2_08
pathmunge /usr/local/j2sdk1.4.2_08/bin
2.安装
# ./configure --prefix=/usr/local/resin-3.0.8 --with-apxs=/usr/local/apache/bin/apxs --with-apache=/usr/local/apache
#make
#make install
#make clean
3.配置
修改resin配置文件:
1.<thread-max>2500</thread-max>:最大线程数
2.<spare-thread-min>100</spare0thread-min>:空闲线程数
3.<keepalive-max>300</keepalive-max>:最多可保留连接数
4.< keepalive-timeout>10s</ keepalive-timeout>:连接超时时间
启动resin使用参数
#/usr/local/resin-3.0.8/bin/httpd.sh –Xmn100M –Xms500M –Xmx500M start
4.整合apache
修改httpd.conf,加入
LoadModule caucho_module /usr/local/apache/modules/mod_caucho.so
<IfModule mod_caucho.c>
CauchoConfigFile /usr/local/resin-3.0.8/conf/resin.conf
<Location /caucho-status>
SetHandler caucho-status
</Location>
</IfModule>
重新启动apache和resin
/usr/local/resin-2.1.4/bin/httpd.sh stop
/usr/local/apache/bin/apachectl stop
/usr/local/resin-2.1.4/bin/httpd.sh start
/usr/local/apache/bin/apachectl start
浏览器打开
http://ip/caucho-status
如果出现
Status : Caucho Servlet Engine
表示没有问题了