웹서버는 직접적으로 관리를 하지 않아 설치 해볼일이 없었는데 테스트 시 필요해서 설치 해봤다.
[환경 2.4.x 케이스] 하단에 2.2.x 케이스도 있음
CentOS release 6.4 (Final) 64Bit
httpd-2.4.18
apr-1.5.2
apr-util-1.5.4
pcre-8.37
tomcat-connectors-1.2.41
tomcat 8.0.30
mkdir download cd download/ wget http://apache.mirror.cdnetworks.com//httpd/httpd-2.4.18.tar.gz tar xvzf httpd-2.4.18.tar.gz wget http://mirror.apache-kr.org/apr/apr-1.5.2.tar.gz tar xvzf apr-1.5.2.tar.gz wget http://mirror.apache-kr.org/apr/apr-util-1.5.4.tar.gz tar xvzf apr-util-1.5.4.tar.gz mv apr-1.5.2 httpd-2.4.18/srclib/apr mv apr-util-1.5.4 httpd-2.4.18/srclib/apr-util wget http://sourceforge.net/projects/pcre/files/pcre/8.37/pcre-8.37.tar.gz/download tar xvzf pcre-8.37.tar.gz cd pcre-8.37 ./configure --enable-unicode-properties=yes make && make install ./configure \ --prefix=/usr/local/tomcat/apache-2.4.18 \ --enable-so \ --enable-rewrite \ --enable-proxy \ --enable-ssl \ --enable-mods-shared=all \ --enable-modules=shared \ --enable-mpms-shared=all \ --with-included-apr \ --with-included-apr-util make && make install /usr/local/tomcat/apache-2.4.18/bin/httpd -V chown root:sys /usr/local/tomcat/apache-2.4.18/bin/httpd chmod +s /usr/local/tomcat/apache-2.4.18/bin/httpd /usr/local/tomcat/apache-2.4.18/httpd.conf ServerName localhost // 주석 해제 및 설정 LoadModule slotmem_shm_module modules/mod_slotmem_shm.so // 주석 해제 /usr/local/tomcat/apache-2.4.18/bin/httpd -k start /usr/local/tomcat/apache-2.4.18/bin/httpd -k stop wget http://apache.tt.co.kr/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.41-src.tar.gz tar xvzf tomcat-connectors-1.2.41-src.tar.gz cd tomcat-connectors-1.2.41-src/native ./configure --with-apxs=/usr/local/tomcat/apache-2.4.18/bin/apxs make && make install ls -l /usr/local/tomcat/apache-2.4.18/modules/mod_jk.so cp 톰켓롬/bin/tomcat-native.tar.gz . tar xvzf tomcat-native.tar.gz cd tomcat-native-1.1.33-src/jni/native ./configure --with-apr=/usr/local/tomcat/apache-2.4.18/bin/apr-1-config --prefix=/usr/local/tomcat/apache-tomcat-8.0.30 make && make install 톰캣 설정 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CATALINA_HOME/lib export LD_LIBRARY_PATH Include conf/extra/mod_jk.conf vi /usr/local/tomcat/apache-2.4.18/conf/httpd.conf # Virtual hosts Include conf/extra/httpd-vhosts.conf // 주석 해제 # Various default settings Include conf/extra/httpd-default.conf // 주석 해제 Include conf/extra/mod_jk.conf vi vi /usr/local/tomcat/apache-2.4.18/conf/extra/mod_jk.conf # ----------------------------------------- # DAK TEST Apache Httpd WebServer # # contact : ddakker@ddakker.com # ----------------------------------------- # Load mod_jk module # Update this path to match your modules location LoadModule jk_module modules/mod_jk.so # Where to find workers.properties # Update this path to match your conf directory location (put workers.properties next to httpd.conf) JkWorkersFile conf/extra/workers.properties # Where to put jk logs # Update this path to match your logs directory location (put mod_jk.log next to access_log) JkLogFile "|logs/mod_jk.log logs/mod_jk.log_%m%d%Y" JkShmFile logs/mod_jk.shm # Set the jk log level [debug/error/info] JkLogLevel info # Select the log format JkLogStampFormat "[%Y-%m-%d %H:%M:%S] " # JkOptions indicate to send SSL KEY SIZE, JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories +ForwardURICompatUnparsed # JkRequestLogFormat set the request format JkRequestLogFormat "%w %V %T %R %s %U" # Send everything for context /examples to worker named worker1 (ajp13) JkMount /jkstatus* jkstatus <location /jkstatus> JkMount jkstatus Order Deny,Allow Allow from 127.0.0.1 Allow from 192 Deny from all </location> vi /usr/local/tomcat/apache-2.4.18/conf/extra/workers.properties # ----------------------------------------- # DAK TEST Apache Httpd WebServer # # contact : ddakker@naver.com # ----------------------------------------- worker.list=jkstatus,testcluster # Templates worker.template.type=ajp13 worker.template.maintain=60 worker.template.lbfactor=1 worker.template.ping_mode=A worker.template.ping_timeout=2000 worker.template.prepost_timeout=2000 worker.template.socket_timeout=300 worker.template.socket_connect_timeout=2000 worker.template.socket_keepalive=true worker.template.connection_pool_timeout=300 worker.template.connect_timeout=10000 worker.template.recovery_options=7 worker.testcluster11.reference=worker.template worker.testcluster11.host=192.168.0.2 worker.testcluster11.port=9401 worker.testcluster21.reference=worker.template worker.testcluster21.host=192.168.0.3 worker.testcluster21.port=9401 # -------- LB ------------ worker.testcluster.type=lb worker.testcluster.method=Session worker.testcluster.sticky_session=True worker.testcluster.balance_workers=testcluster11,testcluster21 worker.jkstatus.type=status vi httpd-vhosts.conf NameVirtualHost *:80 # Vhost - Tomcat Service Include conf/extra/vhost-tomcat.conf vi vhost-tomcat.conf <virtualhost *:80> DocumentRoot "/data/webroot/test-cluster/webapp" ServerName testcluster.ddakker.pe.kr ServerAlias cluster.ddakker.pe.kr #ErrorLog "|/usr/sbin/cronolog /usr/local/tomcat/apache2/logs/cluster.ddakker.pe.kr-error_log.%m%d%Y" #CustomLog "|/usr/sbin/cronolog/usr/local/tomcat/apache2/logs/cluster.ddakker.pe.kr-access_log.%m%d%Y" combined DirectoryIndex /index.html /index.jsp JkUnMount /*.js testcluster JkUnMount /*.css testcluster JkUnMount /*.jpg testcluster JkUnMount /*.png testcluster JkUnMount /*.gif testcluster JkUnMount /*.htm testcluster JkUnMount /*.html testcluster JkUnMount /*.ico testcluster JkUnMount /*.eot testcluster JkUnMount /*.woff testcluster JkMount /* testcluster JkMount /jkstatus* jkstatus <directory "/data/webroot/test-cluster/webapp"> Options FollowSymLinks AllowOverride None <ifversion < 2.3> Order allow,deny Allow from all </ifversion> <ifversion >= 2.3> Require all granted </ifversion> </directory> </VirtualHost>
[환경 2.2.x 케이스]
CentOS release 6.4 (Final) 64Bit
httpd-2.2.31
tomcat-connectors-1.2.41
wget http://apache.mirror.cdnetworks.com/httpd/httpd-2.2.31.tar.gz tar xvzf httpd-2.2.31.tar.gz cd httpd-2.2.31 ./configure --prefix=/usr/local/tomcat/apache2 make make install chown root:sys /usr/local/tomcat/apache2/bin/httpd chmod +s /usr/local/tomcat/apache2/bin/httpd /usr/local/tomcat/apache2/bin/httpd -k start /usr/local/tomcat/apache2/bin/httpd -k stop wget http://apache.tt.co.kr/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.41-src.tar.gz tar xvzf tomcat-connectors-1.2.41-src.tar.gz cd tomcat-connectors-1.2.41-src/native ./configure --with-apxs=/usr/local/tomcat/apache2/bin/apxs make make install ls -l /usr/local/tomcat/apache2/modules/mod_jk.so cd /usr/local/tomcat/apache2/conf vi httpd.conf # Virtual hosts Include conf/extra/httpd-vhosts.conf # Various default settings Include conf/extra/httpd-default.conf Include conf/extra/mod_jk.conf vi /extra/mod_jk.conf # ----------------------------------------- # DAK TEST Apache Httpd WebServer # # contact : ddakker@ddakker.com # ----------------------------------------- #LoadModule jk_module modules/mod_jk.so ## JkWorkersFile conf/extra/workers.properties # JkLogFile logs/mod_jk.log # JkLogLevel info # # Load mod_jk module # Update this path to match your modules location LoadModule jk_module modules/mod_jk.so # Where to find workers.properties # Update this path to match your conf directory location (put workers.properties next to httpd.conf) JkWorkersFile conf/extra/workers.properties # Where to put jk logs # Update this path to match your logs directory location (put mod_jk.log next to access_log) JkLogFile "|logs/mod_jk.log logs/mod_jk.log_%m%d%Y" JkShmFile logs/mod_jk.shm # Set the jk log level [debug/error/info] JkLogLevel info # Select the log format JkLogStampFormat "[%Y-%m-%d %H:%M:%S] " # JkOptions indicate to send SSL KEY SIZE, JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories +ForwardURICompatUnparsed # JkRequestLogFormat set the request format JkRequestLogFormat "%w %V %T %R %s %U" # Send everything for context /examples to worker named worker1 (ajp13) JkMount /jkstatus* jkstatus <location /jkstatus> JkMount jkstatus Order Deny,Allow Allow from 127.0.0.1 Allow from 192 Deny from all </location> vi extra/workers.properties # ----------------------------------------- # DAK TEST Apache Httpd WebServer # # contact : ddakker@naver.com # ----------------------------------------- worker.list=jkstatus,testcluster # Templates worker.template.type=ajp13 worker.template.maintain=60 worker.template.lbfactor=1 worker.template.ping_mode=A worker.template.ping_timeout=2000 worker.template.prepost_timeout=2000 worker.template.socket_timeout=300 worker.template.socket_connect_timeout=2000 worker.template.socket_keepalive=true worker.template.connection_pool_timeout=300 worker.template.connect_timeout=10000 worker.template.recovery_options=7 worker.testcluster11.reference=worker.template worker.testcluster11.host=192.168.0.2 worker.testcluster11.port=9401 worker.testcluster21.reference=worker.template worker.testcluster21.host=192.168.0.3 worker.testcluster21.port=9401 # -------- LB ------------ worker.testcluster.type=lb worker.testcluster.method=Session worker.testcluster.sticky_session=True worker.testcluster.balance_workers=testcluster11,testcluster21 worker.jkstatus.type=status vi httpd-vhosts.conf NameVirtualHost *:80 # Vhost - Tomcat Service Include conf/extra/vhost-tomcat.conf vi vhost-tomcat.conf <virtualhost *:80> DocumentRoot "/data/webroot/test-cluster/webapp" ServerName testcluster.ddakker.pe.kr ServerAlias cluster.ddakker.pe.kr #ErrorLog "|/usr/sbin/cronolog /usr/local/tomcat/apache2/logs/cluster.ddakker.pe.kr-error_log.%m%d%Y" #CustomLog "|/usr/sbin/cronolog/usr/local/tomcat/apache2/logs/cluster.ddakker.pe.kr-access_log.%m%d%Y" combined DirectoryIndex /index.html /index.jsp JkUnMount /*.js testcluster JkUnMount /*.css testcluster JkUnMount /*.jpg testcluster JkUnMount /*.png testcluster JkUnMount /*.gif testcluster JkUnMount /*.htm testcluster JkUnMount /*.html testcluster JkUnMount /*.ico testcluster JkUnMount /*.eot testcluster JkUnMount /*.woff testcluster JkMount /* testcluster JkMount /jkstatus* jkstatus <directory "/data/webroot/test-cluster/webapp"> Options FollowSymLinks AllowOverride None <ifversion < 2.3> Order allow,deny Allow from all </ifversion> <ifversion >= 2.3> Require all granted </ifversion> </directory> </virtualhost> vi /usr/local/tomcat/webroot/test-cluster/webapp/index.htmlindex.html
vi /usr/local/tomcat/webroot/test-cluster/webapp/info.jsp <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> <%@page import="java.net.InetAddress"%> <% String serverIP = ""; try{ serverIP = InetAddress.getLocalHost().getHostAddress(); serverIP = serverIP.substring(serverIP.lastIndexOf(".")+1); }catch(Exception e){} String info = request.getServerName() + ", " + serverIP + ", " + System.getProperty("jvmRoute"); out.print(info); //System.out.println(info); %> vi /etc/hosts 127.0.0.1 localhost testcluster.ddakker.pe.kr wget http://testcluster.ddakker.pe.kr/index.html wget http://testcluster.ddakker.pe.kr/info.jsp wget http://testcluster.ddakker.pe.kr/jkstatus
[tomcat & tomcat-native 만 설치]
wget http://mirror.apache-kr.org/apr/apr-1.5.2.tar.gz tar xvzf apr-1.5.2.tar.gz ./configure make & make install wget http://mirror.apache-kr.org/apr/apr-util-1.5.4.tar.gz tar xvzf apr-util-1.5.4.tar.gz ./configure --with-apr=/usr/local/apr make & make install tar xvzf tomcat-native.tar.gz ./configure --with-apr=/usr/local/apr/bin/apr-1-config make && make install LD_LIBRARY_PATH=/usr/local/apr/lib export LD_LIBRARY_PATH