이전에 Apache2와 Tomcat9 을 설치 했었는데 둘을 연동하려합니다
사실 Tomcat포트를 80으로 변경하면 포트번호 없이도 접속할 수 있겠지만
보통 JSP개발은 tomcat만 이용하고 운영할때는 apache + tomcat이 정석으로 보면됩니다
WEBTOBE + JEUS 같은 느낌이랄까나...
각설하고
apache 설치를 안했다면 http://zelkun.tistory.com/69 여기를
tomcat 설치를 안했다면 http://zelkun.tistory.com/68 여기를 참고합니다
변경사항으로는 tomcat을 /usr/local/tomcat9 으로 이동했고
pi/tomcat9으로 링크를 걸어놨으니 참고하시길..
예전에 데스크탑 서버에다 apache를 직접설치하고 설정도 해보고 해서 그대로
pi에다가 적용해봤었는데 둘이 따로 놀아서 GG했던 경험이...
pi@rasp2-dev:~ $ apachectl -v Server version: Apache/2.4.10 (Raspbian) Server built: Sep 17 2016 16:40:43 pi@rasp2-dev:~ $ /usr/local/tomcat9/bin/version.sh Using CATALINA_BASE: /usr/local/tomcat9 Using CATALINA_HOME: /usr/local/tomcat9 Using CATALINA_TMPDIR: /usr/local/tomcat9/temp Using JRE_HOME: /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt Using CLASSPATH: /usr/local/tomcat9/bin/bootstrap.jar:/usr/local/tomcat9/bin/tomcat-juli.jar Server version: Apache Tomcat/9.0.0.M3 Server built: Feb 1 2016 20:52:49 UTC Server number: 9.0.0.0 OS Name: Linux OS Version: 4.4.8-v7+ Architecture: arm JVM Version: 1.8.0_65-b17 JVM Vendor: Oracle Corporation |
apt-get를 이용하면 필수lib 설치등의 절차가 생략되는 장점이 있죠 명령어하나로 다 된다니 신세경.. (apache2.4.9 직접 설치하다 빡친경험이 있는 1인..)
sudo apt-get install libapache2-mod-jk -y
pi@rasp2-dev:~ $ sudo apt-get install libapache2-mod-jk -y Reading package lists... Done Building dependency tree Reading state information... Done Suggested packages: libapache-mod-jk-doc tomcat8 The following NEW packages will be installed: libapache2-mod-jk 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. Need to get 143 kB of archives. After this operation, 392 kB of additional disk space will be used. Get:1 http://mirrordirector.raspbian.org/raspbian/ jessie/main libapache2-mod-jk armhf 1:1.2.37-4+deb8u1 [143 kB] Fetched 143 kB in 4s (34.8 kB/s) Selecting previously unselected package libapache2-mod-jk. (Reading database ... 127405 files and directories currently installed.) Preparing to unpack .../libapache2-mod-jk_1%3a1.2.37-4+deb8u1_armhf.deb ... Unpacking libapache2-mod-jk (1:1.2.37-4+deb8u1) ... Setting up libapache2-mod-jk (1:1.2.37-4+deb8u1) ... apache2_invoke: Enable module jk pi@rasp2-dev:~ $ |
tomcat-connetor를 설치했으니 이제 apach2.conf를 수정합니다
apache2 설정파일은 /etc/apache2 에 위치해 있습니다
apache2.conf가 설정파일 conf/httpd.conf 가 아님..
pi@rasp2-dev:/etc/apache2 $ pwd /etc/apache2 pi@rasp2-dev:/etc/apache2 $ ls -al total 108 drwxr-xr-x 8 root root 4096 Mar 9 14:22 . drwxr-xr-x 123 root root 12288 Dec 17 00:58 .. -rw-r--r-- 1 root root 7151 Nov 19 17:13 apache2.conf drwxr-xr-x 2 root root 4096 Nov 13 11:11 conf-available drwxr-xr-x 2 root root 4096 Nov 13 00:04 conf-enabled -rw-r--r-- 1 root root 1782 Oct 24 2015 envvars -rw-r--r-- 1 root root 31063 Oct 24 2015 magic drwxr-xr-x 2 root root 12288 Nov 13 23:26 mods-available drwxr-xr-x 2 root root 4096 Nov 13 23:26 mods-enabled -rw-r--r-- 1 root root 320 Oct 24 2015 ports.conf drwxr-xr-x 2 root root 4096 Nov 13 11:11 sites-available drwxr-xr-x 2 root root 4096 Feb 10 2016 sites-enabled pi@rasp2-dev:/etc/apache2 $ |
mod_jk를 사용하기 위해 설정값을 변경해줍니다
pi@rasp2-dev:/etc/apache2 $ vi apache2.conf
132 # 133 # LogLevel: Control the severity of messages logged to the error_log. 134 # Available values: trace8, ..., trace1, debug, info, notice, warn, 135 # error, crit, alert, emerg. 136 # It is also possible to configure the log level for particular modules, e.g 137 # "LogLevel info ssl:warn" 138 # 139 LogLevel warn 140 141 # Include module configuration: 142 IncludeOptional mods-enabled/*.load 143 IncludeOptional mods-enabled/*.conf 144 145 # Include list of ports to listen on 146 Include ports.conf 147 148 149 # Sets the default security model of the Apache2 HTTPD server. It does 150 # not allow access to the root filesystem outside of /usr/share and /var/www 151 # The former is used by web applications packaged in Debian, 152 # the latter may be used for local directories served by the web server. If 153 # your system is serving content from a sub-directory in /srv you must allow
202 # requested file), because the latter makes it impossible to detect partial 203 # requests. 204 # 205 # Note that the use of %{X-Forwarded-For}i instead of %h is not recommended. 206 # Use mod_remoteip instead. 207 # 208 LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\ 209 LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" com 210 LogFormat "%h %l %u %t \"%r\" %>s %O" common 211 LogFormat "%{Referer}i -> %U" referer 212 LogFormat "%{User-agent}i" agent 213 214 # Include of directories ignores editors' and dpkg's backup files, 215 # see README.Debian for details. 216 217 # Include generic snippets of statements 218 IncludeOptional conf-enabled/*.conf 219 220 # Include the virtual host configurations: 221 IncludeOptional sites-enabled/*.conf 222 223 # vim: syntax=apache ts=4 sw=4 sts=4 sr noet 223,1 Bot |
근데 잘 보면 기존에 사용하던
LoadModule jk_module /usr/lib/apache2/modules/mod_jk.so
문구가 없는게 모듈관리를 별도로 하나봅니다
그냥 마지막줄에 추가해도 될것 같긴합니다만... 룰에 맞춰 봅니다 세삼 한숨만..
143 IncludeOptional mods-enabled/*.conf
218 IncludeOptional conf-enabled/*.conf
이렇게 두개가 눈에 띄니 뭔지 확인해봅니다
pi@rasp2-dev:/etc/apache2 $ cd mods-enabled/ pi@rasp2-dev:/etc/apache2/mods-enabled $ pwd /etc/apache2/mods-enabled pi@rasp2-dev:/etc/apache2/mods-enabled $ ls -al total 8 drwxr-xr-x 2 root root 4096 Nov 13 23:26 . drwxr-xr-x 8 root root 4096 Mar 9 14:22 .. lrwxrwxrwx 1 root root 36 Feb 10 2016 access_compat.load -> ../mods-available/access_compat.load lrwxrwxrwx 1 root root 28 Feb 10 2016 alias.conf -> ../mods-available/alias.conf lrwxrwxrwx 1 root root 28 Feb 10 2016 alias.load -> ../mods-available/alias.load lrwxrwxrwx 1 root root 33 Feb 10 2016 auth_basic.load -> ../mods-available/auth_basic.load lrwxrwxrwx 1 root root 33 Feb 10 2016 authn_core.load -> ../mods-available/authn_core.load lrwxrwxrwx 1 root root 33 Feb 10 2016 authn_file.load -> ../mods-available/authn_file.load lrwxrwxrwx 1 root root 33 Feb 10 2016 authz_core.load -> ../mods-available/authz_core.load lrwxrwxrwx 1 root root 33 Feb 10 2016 authz_host.load -> ../mods-available/authz_host.load lrwxrwxrwx 1 root root 32 Nov 12 22:55 authz_svn.load -> ../mods-available/authz_svn.load lrwxrwxrwx 1 root root 33 Feb 10 2016 authz_user.load -> ../mods-available/authz_user.load lrwxrwxrwx 1 root root 32 Feb 10 2016 autoindex.conf -> ../mods-available/autoindex.conf lrwxrwxrwx 1 root root 32 Feb 10 2016 autoindex.load -> ../mods-available/autoindex.load lrwxrwxrwx 1 root root 26 Nov 12 22:55 dav.load -> ../mods-available/dav.load lrwxrwxrwx 1 root root 30 Nov 12 22:55 dav_svn.conf -> ../mods-available/dav_svn.conf lrwxrwxrwx 1 root root 30 Nov 12 22:55 dav_svn.load -> ../mods-available/dav_svn.load lrwxrwxrwx 1 root root 30 Feb 10 2016 deflate.conf -> ../mods-available/deflate.conf lrwxrwxrwx 1 root root 30 Feb 10 2016 deflate.load -> ../mods-available/deflate.load lrwxrwxrwx 1 root root 26 Feb 10 2016 dir.conf -> ../mods-available/dir.conf lrwxrwxrwx 1 root root 26 Feb 10 2016 dir.load -> ../mods-available/dir.load lrwxrwxrwx 1 root root 26 Feb 10 2016 env.load -> ../mods-available/env.load lrwxrwxrwx 1 root root 29 Feb 10 2016 filter.load -> ../mods-available/filter.load lrwxrwxrwx 1 root root 25 Nov 13 23:26 jk.conf -> ../mods-available/jk.conf lrwxrwxrwx 1 root root 25 Nov 13 23:26 jk.load -> ../mods-available/jk.load lrwxrwxrwx 1 root root 27 Feb 10 2016 mime.conf -> ../mods-available/mime.conf lrwxrwxrwx 1 root root 27 Feb 10 2016 mime.load -> ../mods-available/mime.load lrwxrwxrwx 1 root root 34 Feb 10 2016 mpm_prefork.conf -> ../mods-available/mpm_prefork.conf lrwxrwxrwx 1 root root 34 Feb 10 2016 mpm_prefork.load -> ../mods-available/mpm_prefork.load lrwxrwxrwx 1 root root 34 Feb 10 2016 negotiation.conf -> ../mods-available/negotiation.conf lrwxrwxrwx 1 root root 34 Feb 10 2016 negotiation.load -> ../mods-available/negotiation.load lrwxrwxrwx 1 root root 27 Feb 10 2016 php5.conf -> ../mods-available/php5.conf lrwxrwxrwx 1 root root 27 Feb 10 2016 php5.load -> ../mods-available/php5.load lrwxrwxrwx 1 root root 31 Feb 10 2016 setenvif.conf -> ../mods-available/setenvif.conf lrwxrwxrwx 1 root root 31 Feb 10 2016 setenvif.load -> ../mods-available/setenvif.load lrwxrwxrwx 1 root root 29 Feb 10 2016 status.conf -> ../mods-available/status.conf lrwxrwxrwx 1 root root 29 Feb 10 2016 status.load -> ../mods-available/status.load pi@rasp2-dev:/etc/apache2/mods-enabled $ cd ../conf-enabled pi@rasp2-dev:/etc/apache2/conf-enabled $ pwd /etc/apache2/conf-enabled pi@rasp2-dev:/etc/apache2/conf-enabled $ ls -al total 8 drwxr-xr-x 2 root root 4096 Nov 13 00:04 . drwxr-xr-x 8 root root 4096 Mar 9 14:22 .. lrwxrwxrwx 1 root root 30 Feb 10 2016 charset.conf -> ../conf-available/charset.conf lrwxrwxrwx 1 root root 29 Nov 13 00:04 gitweb.conf -> ../conf-available/gitweb.conf lrwxrwxrwx 1 root root 44 Feb 10 2016 localized-error-pages.conf -> ../conf-available/localized-error-pages.conf lrwxrwxrwx 1 root root 46 Feb 10 2016 other-vhosts-access-log.conf -> ../conf-available/other-vhosts-access-log.conf lrwxrwxrwx 1 root root 31 Feb 10 2016 security.conf -> ../conf-available/security.conf lrwxrwxrwx 1 root root 36 Feb 10 2016 serve-cgi-bin.conf -> ../conf-available/serve-cgi-bin.conf
|
mods-enabled를 보니 jk.conf 와 jk.load 가
conf-enabled를 보니 언어셋 등 apache 기본 설정부분이 눈에 띄네요
mods-enabled/jk.conf jk.load를 확인해봅니다
pi@rasp2-dev:/etc/apache2/mods-enabled $ pwd /etc/apache2/mods-enabled pi@rasp2-dev:/etc/apache2/mods-enabled $ cat ./jk.conf # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License.
# Configuration Example for mod_jk # used in combination with Apache 2.2.x
<IfModule jk_module>
# We need a workers file exactly once # and in the global server JkWorkersFile /etc/libapache2-mod-jk/workers.properties
# Our JK error log # You can (and should) use rotatelogs here JkLogFile /var/log/apache2/mod_jk.log
# Our JK log level (trace,debug,info,warn,error) JkLogLevel info
# Our JK shared memory file JkShmFile /var/log/apache2/jk-runtime-status
# Define a new log format you can use in any CustomLog in order # to add mod_jk specific information to your access log. # LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{Cookie}i\" \"%{Set-Cookie}o\" %{pid}P %{tid}P %{JK_LB_FIRST_NAME}n %{JK_LB_LAST_NAME}n ACC %{JK_LB_LAST_ACCESSED}n ERR %{JK_LB_LAST_ERRORS}n BSY %{JK_LB_LAST_BUSY}n %{JK_LB_LAST_STATE}n %D" extended_jk
# This option will reject all requests, which contain an # encoded percent sign (%25) or backslash (%5C) in the URL # If you are sure, that your webapp doesn't use such # URLs, enable the option to prevent double encoding attacks. # Since: 1.2.24 # JkOptions +RejectUnsafeURI
# After setting JkStripSession to "On", mod_jk will # strip all ";jsessionid=..." from request URLs it # does *not* forward to a backend. # This is useful, if all links in a webapp use # URLencoded session IDs and parts of the static # content should be delivered directly by Apache. # Of course you can also do it with mod_rewrite. # Since: 1.2.21 # JkStripSession On
# Start a separate thread for internal tasks like # idle connection probing, connection pool resizing # and load value decay. # Run these tasks every JkWatchdogInterval seconds. # Since: 1.2.27 JkWatchdogInterval 60
# Configure access to jk-status and jk-manager # If you want to make this available in a virtual host, # either move this block into the virtual host # or copy it logically there by including "JkMountCopy On" # in the virtual host. # Add an appropriate authentication method here! <Location /jk-status> # Inside Location we can omit the URL in JkMount JkMount jk-status Order deny,allow Deny from all Allow from 127.0.0.1 </Location> <Location /jk-manager> # Inside Location we can omit the URL in JkMount JkMount jk-manager Order deny,allow Deny from all Allow from 127.0.0.1 </Location>
# If you want to put all mounts into an external file # that gets reloaded automatically after changes # (with a default latency of 1 minute), # you can define the name of the file here. # JkMountFile conf/extra/uriworkermap.properties
# Example for Mounting a context to the worker "balancer" # The URL syntax "a|b" instantiates two mounts at once, # the first one is "a", the second one is "ab". # JkMount /myapp|/* balancer
# Example for UnMounting requests for all workers # using a simple URL pattern # Since: 1.2.26 # JkUnMount /myapp/static/* *
# Example for UnMounting requests for a named worker # JkUnMount /myapp/images/* balancer
# Example for UnMounting requests using regexps # SetEnvIf REQUEST_URI "\.(htm|html|css|gif|jpg|js)$" no-jk
# Example for setting a reply timeout depending on the request URL # Since: 1.2.27 # SetEnvIf Request_URI "/transactions/" JK_REPLY_TIMEOUT=600000
# Example for disabling reply timeouts for certain request URLs # Since: 1.2.27 # SetEnvIf Request_URI "/reports/" JK_REPLY_TIMEOUT=0
# IMPORTANT: Mounts and virtual hosts # If you are using VirtualHost elements, you # - can put mounts only used in some virtual host into its VirtualHost element # - can copy all global mounts to it using "JkMountCopy On" inside the VirtualHost # - can copy all global mounts to all virtual hosts by putting # "JkMountCopy All" into the global server # Since: 1.2.26
</IfModule> pi@rasp2-dev:/etc/apache2/mods-enabled $ cat ./jk.conf LoadModule jk_module /usr/lib/apache2/modules/mod_jk.so pi@rasp2-dev:/etc/apache2/mods-enabled $ |
세상에 libapache2-mod-jk 설치하면서 자동으로 LoadModule 설정까지.. 되나보네요
세상 삽질한기분..
그럼 요청 Url처리를 하도록 Jkmount 를 추가해주고
workers.properties를 만들어줘야 겠네요
pi@rasp2-dev:/etc/apache2 $ cd sites- sites-available/ sites-enabled/ pi@rasp2-dev:/etc/apache2 $ cd sites-available/ pi@rasp2-dev:/etc/apache2/sites-available $ ls -al total 24 drwxr-xr-x 2 root root 4096 Mar 24 21:12 . drwxr-xr-x 8 root root 4096 Mar 9 14:22 .. -rw-r--r-- 1 root root 1332 Oct 24 2015 000-default.conf -rw-r--r-- 1 root root 6437 Oct 24 2015 default-ssl.conf pi@rasp2-dev:/etc/apache2/sites-available $ cat 000-default.conf <VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName www.example.com
ServerAdmin webmaster@localhost DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf </VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet pi@rasp2-dev:/etc/apache2/sites-available $ |
어디에 넣어야 하나 고민하다가 보니 sites-available / sites-enabled 가 보이네요.
어디까지 나눠놓은거지...
sites-available 에 rasp2-dev.conf 파일을 하나 생성하고
VirtualHost 설정에 JkMount /* tomcat9 로 해놨습니다
요청오면 전부 tomcat9에서 처리해라 이거죠
사실 정적파일은 apache에서 처리하도록 하는게 더 빠르니 참고하시길
주로 resource로 img, js, css 파일들
/etc/apache2/sites-available 에서 작업했습니다
pi@rasp2-dev:/etc/apache2/sites-available $ sudo vi rasp2-dev.conf
1 <VirtualHost *:80> 2 # The ServerName directive sets the request scheme, hostname and por 3 # the server uses to identify itself. This is used when creating 4 # redirection URLs. In the context of virtual hosts, the ServerName 5 # specifies what hostname must appear in the request's Host: header 6 # match this virtual host. For the default virtual host (this file) 7 # value is not decisive as it is used as a last resort host regardle 8 # However, you must set it for any further virtual host explicitly. 9 #ServerName www.example.com 10 11 JkMount /* tomcat9 12 13 #ServerAdmin webmaster@localhost 14 #DocumentRoot /var/www/html 15 16 # Available loglevels: trace8, ..., trace1, debug, info, notice, war 17 # error, crit, alert, emerg. 18 # It is also possible to configure the loglevel for particular 19 # modules, e.g. 20 #LogLevel info ssl:warn 21 22 ErrorLog ${APACHE_LOG_DIR}/error.log "rasp2-dev.conf" 33L, 1356C 1,1 Top |
그리고 기존에 설정된 000-default.conf 를 삭제하고 rasp2-dev.conf를 sites-enabled에 링크를 걸어줬습니다 그냥 sites-enabled에다 작성하고 000-default.conf를 삭제해도 됩니다
설정들이 available에 되있고 enabled에 링크걸린걸 따라한거라 전혀 상관없습니다
취향인거죠
/etc/apache2/sites-enabled 에서 작업했습니다
pi@rasp2-dev:/etc/apache2/sites-enabled $ ls -al total 8 drwxr-xr-x 2 root root 4096 Mar 24 21:21 . drwxr-xr-x 8 root root 4096 Mar 9 14:22 .. lrwxrwxrwx 1 root root 35 Mar 24 21:21 000-default.conf -> ../sites-available/000-default.conf pi@rasp2-dev:/etc/apache2/sites-enabled $ sudo ln -s ../sites-available/rasp2-dev.conf rasp2-dev.conf pi@rasp2-dev:/etc/apache2/sites-enabled $ ls -al total 8 drwxr-xr-x 2 root root 4096 Mar 24 21:21 . drwxr-xr-x 8 root root 4096 Mar 9 14:22 .. lrwxrwxrwx 1 root root 35 Mar 24 21:21 000-default.conf -> ../sites-available/000-default.conf lrwxrwxrwx 1 root root 33 Mar 24 21:13 rasp2-dev.conf -> ../sites-available/rasp2-dev.conf pi@rasp2-dev:/etc/apache2/sites-enabled $ sudo rm 000-default.conf pi@rasp2-dev:/etc/apache2/sites-enabled $ ls -al total 8 drwxr-xr-x 2 root root 4096 Mar 24 21:24 . drwxr-xr-x 8 root root 4096 Mar 9 14:22 .. lrwxrwxrwx 1 root root 33 Mar 24 21:13 rasp2-dev.conf -> ../sites-available/rasp2-dev.conf pi@rasp2-dev:/etc/apache2/sites-enabled $ |
workers.properties 파일은 mod_jk 가 설치된
/etc/libapache2-mod-jk 에 위치해있습니다
뭐 mods-available/jk.conf 에서 위치를 변경해도 될것 같긴합니다만
이미 만들어져있는데 굳이 새로 만들필요가 없으니 수정합니다
pi@rasp2-dev:/etc/libapache2-mod-jk $ pwd /etc/libapache2-mod-jk pi@rasp2-dev:/etc/libapache2-mod-jk $ ls -al total 20 drwxr-xr-x 2 root root 4096 Nov 13 23:26 . drwxr-xr-x 123 root root 12288 Dec 17 00:58 .. lrwxrwxrwx 1 root root 33 Jun 4 2015 httpd-jk.conf -> ../apache2/mods-available/jk.conf -rw-r--r-- 1 root root 2946 Nov 17 2014 workers.properties pi@rasp2-dev:/etc/libapache2-mod-jk $ |
pi@rasp2-dev:/etc/libapache2-mod-jk $ vi workers.properties
35 workers.tomcat_home=/usr/local/tomcat9 42 workers.java_home=/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt
48 ps=/ 62 worker.list=tomcat9
73 worker.tomcat9.port=8009 74 worker.tomcat9.host=localhost 75 worker.tomcat9.type=ajp13
100 worker.loadbalancer.type=lb 101 worker.loadbalancer.balance_workers=tomcat9
23,1 27% |
라인(숫자)는 신경쓰지 마시세요 보기편하게 설정한 내용만 추렸습니다
AJP13(Apache Jserv Protocol)는 검색하시고
tomcat-hom과 java_home은 버전확인할때 본 정보로 넣어주시면됩니다
worker 설정을 tomcat 정보로 넣어줍니다
100, 101은 loadbalancer 기능인데 한대라서 의미없긴합니다...
적어도 2대 이상있어야...하고 주석처리되있어도 동작하는데 문제없습니다
tomcat server.xml에 이미
ajp13 포트가 8009로 설정되있고 host는 동일 서버라 localhost 입니다
여기까지 해놔도 연동에는 문제없습니다..
앞에 말한데로 로드밸런스를 하기위핸 적어도 2대는 있어야하는대
1대라서 의미가 없습니다
workers.properties와 server.xml의 정보를 맞춰줘야 합니다만
이미 톰캣설정에 맞춰서 workers.properties를 만들어놔서 손을 안대도 됩니다
로드밸런스 할때만 의미있습니다
2대 이상일때는 loadbalancer로 지정한 tomcat9과 jvmRoute를 맞춰주면 됩니다
해도그만 안해도 그만...
pi@rasp2-dev:/etc/libapache2-mod-jk $ vi /usr/local/tomcat9/conf/server.xml
110 <!-- Define an AJP 1.3 Connector on port 8009 --> 111 <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> 112 113 114 <!-- An Engine represents the entry point (within Catalina) that process 115 every request. The Engine implementation for Tomcat stand alone 116 analyzes the HTTP headers included with the request, and passes the 117 on to the appropriate Host (virtual host). 118 Documentation at /docs/config/engine.html --> 119 120 <!-- You should set jvmRoute to support load-balancing via AJP ie :--> 121 <Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat9"> 122 <!-- 123 <Engine name="Catalina" defaultHost="localhost"> 124 --> 125 <!--For clustering, please take a look at documentation at: 126 /docs/cluster-howto.html (simple how to) 127 /docs/config/cluster.html (reference documentation) --> 128 <!-- 129 <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/> 130 --> 131 120,25 77% |
수정했으면 tomcat, apache 순으로 재시작을 해봅니다
pi@rasp2-dev:/etc/libapache2-mod-jk $ ~/tomcat9/bin/ catalina.sh digest.sh startup.sh configtest.sh setclasspath.sh tool-wrapper.sh daemon.sh shutdown.sh version.sh pi@rasp2-dev:/etc/libapache2-mod-jk $ ~/tomcat9/bin/startup.sh Using CATALINA_BASE: /home/pi/tomcat9 Using CATALINA_HOME: /home/pi/tomcat9 Using CATALINA_TMPDIR: /home/pi/tomcat9/temp Using JRE_HOME: /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt Using CLASSPATH: /home/pi/tomcat9/bin/bootstrap.jar:/home/pi/tomcat9/bin/tomcat-juli.jar Tomcat started. pi@rasp2-dev:/etc/libapache2-mod-jk $ jps 10816 Jps 10801 Bootstrap pi@rasp2-dev:/etc/libapache2-mod-jk $ sudo apachectl restart pi@rasp2-dev:/etc/libapache2-mod-jk $ |
연동확인은 별거 없습니다
브라우져에서 http://localhost:8080 과 http://localhost 를 접속해 보면 되거든요
80포트는 기본이라서 넣어도 되고 안넣어도 됩니다 http://localhost:80
기본 8080 포트로 tomcat이 돌고 있습니다
apache 설정을 변경하기 전 80포트 접속화면입니다
apache + tomcat 연동이 적용된 화면입니다
029. Raspberry Pi 라즈베리 파이 - nodejs (Binary) 설치 (0) | 2017.04.17 |
---|---|
028. Raspberry Pi 라즈베리 파이 - nodejs (node-arm) 설치 (0) | 2017.04.10 |
026. Raspberry Pi 라즈베리 파이 - Apache Tomcat 기본포트 변경 (8080 => 8089) (0) | 2017.03.27 |
025. Raspberry Pi 라즈베리 파이 - USB 외장하드 mount 마운트하기 (rc.local) (0) | 2016.08.29 |
024. Raspberry Pi 라즈베리 파이 - USB 외장하드 mount 마운트하기 (fstab) (0) | 2016.08.23 |
댓글 영역