웹서버는 직접적으로 관리를 하지 않아 설치 해볼일이 없었는데 테스트 시 필요해서 설치 해봤다.
[환경 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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | 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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | 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 #<ifmodule jk_module=""> # JkWorkersFile conf/extra/workers.properties # JkLogFile logs/mod_jk.log # JkLogLevel info #</ifmodule> # 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 .html <h1>index.html< /h1 ><h1> 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 < /h1 > |
[tomcat & tomcat-native 만 설치]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 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 |