apache2+resin3.1.5構成


apache 2のインストール
1 . 接続数を最適化します.apacheインストールディレクトリに入り、/server/mpm/worker/workerを編集します.cファイル、パラメータを#define DEFAULTに変更SERVER_LIMIT 2560および#define DEFAULT_THREAD_LIMIT 500
2.コンパイル

./configure --prefix=/home/apache2  --enable-mods-shared='all cache mem-cache disk-cache file-cache' --enable-deflate --enable-rewrite  --enable-headers  --enable-expires  --enable-modules="most" --enable-suexec --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr --enable-rewrite --with-mpm=worker --with-perl --enable-maintainer-mode --enable-so --enable-proxy --enable-proxy-connect --enable-proxy-ftp --enable-proxy-http --enable-proxy-ajp --enable-proxy-balancer --with-z=/usr/lib
make
make install

3.  apache http.conf加入

<IfModule mpm_worker_module>
ServerLimit 50
ThreadLimit 100
StartServers 3
MaxClients 5000
MinSpareThreads 75
MaxSpareThreads 250
ThreadsPerChild 100
MaxRequestsPerChild 80000
</IfModule>

apacheテストを開始します.
コンパイルresin 3.1.5

./configure -with-apxs=/home/apache2/bin/apxs
make
make install

工事を配置する.
例:xxエンジニアリング/home/user/workspace/xxeSystem
xxSystemサブディレクトリ:xxProject(格納コード)、bin(格納resin起動と閉じるコード)、conf(resin.conf)、log
静的コードfor apache(html、js、css、image);配置:/home/www/xxProject(工事名)
chown-R daemon:daemon xxProjectt/(権限を変更しapacheがアクセス可能)
binの起動コードstart.sh

#!/bin/sh
WORK_PATH=/home/user/workspace/xxSystem
#resin    
RESIN_HOME=/home/user/software/resin-3.1.5
#jdk  
JAVA_HOME=/home/user/software/jdk1.6.0_03

#  resin      jar ;       
#CLASSPATH=.;
#libpath=$WORK_PATH/webapp/WEB-INF/lib/
#FILES=`ls $libpath`
#for txt in $FILES;
#do
#    CLASSPATH=$CLASSPATH:$libpath$txt
#done

#echo $CLASSPATH

export RESIN_HOME CLASSPATH JAVA_HOME

$RESIN_HOME/bin/httpd.sh -server xx -conf $WORK_PATH/conf/resin.conf start
#-server search -Xms256m -Xmx512m


stop.sh

#!/bin/sh

WORK_PATH=/home/user/workspace/xxSystem

RESIN_HOME=/home/user/software/resin-3.1.5
JAVA_HOME=/home/user/software/jdk1.6.0_03

export RESIN_HOME JAVA_HOME

$RESIN_HOME/bin/httpd.sh -server xx -conf $WORK_PATH/conf/resin.conf stop


apacheの構成
vi conf/http.conf
hosts Include conf/extra/httpd-vhosts.conf(コメント削除)
deny from allを削除
mod_を追加expiresは10%程度の重複要求を減らすことができます

<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 1 days"
ExpiresByType text/html "access plus 1 days"
ExpiresByType text/css "access plus 1 days"
ExpiresByType image/gif "access plus 1 days"
ExpiresByType image/jpeg "access plus 1 days"
ExpiresByType image/jpg "access plus 1 days"
ExpiresByType image/png "access plus 1 days"
EXpiresByType application/x-shockwave-flash "access plus 1 days"
EXpiresByType application/x-javascript      "access plus 1 days"
ExpiresByType video/x-flv "access plus 1 days"
</IfModule

vi conf/extra/httpd-vhosts.conf

Listen 1111
NameVirtualHost *:1111
<VirtualHost *:1111>
    ServerAdmin [email protected]
    DocumentRoot "/home/www/xxProject/webapp"
    ServerName url
   ResinConfigServer localhost 6803
</VirtualHost>
  :6803 resin server     <server id="xx" address="127.0.0.1" port="6803"/>