일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- JPA
- memcached
- 초기 구축
- ollama langflow
- spring boot
- Next.js 14
- React
- 초기 세팅
- jpa entity자동
- 헤더 설정
- java9
- JavaScript
- dto valid
- CentOS6
- spring
- NextJS
- MySQL
- 도커
- header setting
- custom valid
- 리눅스
- docker
- swagger
- java8
- generate entity
- Java
- generate pojos
- SpringBoot
- docker 설치
- jvm
- Today
- Total
개발자의 길
리눅스 - Tomcat 7.0 + JDK + Apache 연동 본문
1. JDK 설치
http://java.sun.com/javase/downloads/index.jsp
[root@yongbok ~]# chmod +x jdk-6u21-linux-i586.bin[root@yongbok ~]# mv jdk1.6.0_21 /usr/local/jdk1.6.0_21
[root@yongbok ~]# ./jdk-6u21-linux-i586.bin
Unpacking...
Checksumming...
어쩌고 저쩌고........
Java(TM) SE Development Kit 6 successfully installed.
Product Registration is FREE and includes many benefits:
* Notification of new versions, patches, and updates
* Special offers on Sun products, services and training
* Access to early releases and documentation
Product and system data will be collected. If your configuration
supports a browser, the Sun Product Registration form for
the JDK will be presented. If you do not register, none of
this information will be saved. You may also register your
JDK later by opening the register.html file (located in
the JDK installation directory) in a browser.
For more information on what data Registration collects and
how it is managed and used, see:
http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html
Press Enter to continue.....
2. Tomcat 설치
http://tomcat.apache.org/미리 컴파일 된 바이너리 파일을 다운로드 합니다.
[root@yongbok ~]# wget http://apache.tt.co.kr/tomcat/tomcat-7/v7.0.0-beta/bin/apache-tomcat-7.0.0.tar.gz
[root@yongbok ~]# tar xzvf apache-tomcat-7.0.0.tar.gz
[root@yongbok ~]# mv apache-tomcat-7.0.0 /usr/local/tomcat
3. JDK, Tomcat PATH 설정
/etc/profile 환경설정 파일 맨 아래에 PATH 를 추가 해줍니다.
[root@yongbok ~]# vi /etc/profile
# Tomcat Setting
export JAVA_HOME=/usr/local/jdk1.6.0_21
export CATALINA_HOME=/usr/local/tomcat
export PATH=$PATH:/usr/local/bin:$JAVA_HOME/bin:$CATALINA_HOME/bin
PATH 설정을 적용시켜 줍니다.
[root@yongbok ~]# source /etc/profile
[root@yongbok ~]# echo $JAVA_HOME
/usr/local/jdk1.6.0_21
[root@yongbok ~]# echo $CATALINA_HOME
/usr/local/tomcat
로그 디렉토리, catalina.out 를 생성 해줍니다.
[root@yongbok ~]# mkdir $CATALINA_HOME/logs
[root@yongbok ~]# chmod 777 $CATALINA_HOME/logs
[root@yongbok ~]# touch $CATALINA_HOME/catalina.out
쉘 스크립트에 실행 권한을 줍니다.
[root@yongbok ~]# chmod +x $CATALINA_HOME/bin/*
톰캣을 실행 해줍니다.
[root@yongbok ~]# $CATALINA_HOME/bin/startup.sh
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/local/jdk1.6.0_21
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.ja
4. mod_jk (Tomcat Connector) 설치
[root@yongbok ~]# wget http://mirror.apache-kr.org/tomcat/tomcat-connectors/jk/source/tomcat-connectors-1.2.30-src.tar.gz
[root@yongbok ~]# tar xzvf tomcat-connectors-1.2.30-src.tar.gz
[root@yongbok ~]# cd tomcat-connectors-1.2.30-src/native
[root@yongbok ~]# chmod +x buildconf.sh
[root@yongbok ~]# ./buildconf.sh
[root@yongbok ~]# ./configure --with-apxs=/usr/local/apache2/bin/apxs --with-java-home=$JAVA_HOME
[root@yongbok ~]# make && make install
아파치 httpd.conf 에 수동으로 모듈 적용, 내용 추가
[root@yongbok ~]# vi /usr/local/apache2/conf/httpd.conf
LoadModule jk_module modules/mod_jk.so
#
<IfModule mod_jk.c>
JkWorkersFile conf/workers.properties
JkLogFile mod_jk.log
JkLogLevel error
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
</IfModule>
# 인덱스페이지에 JSP 를 사용하도록 설정
<IfModule dir_module>
DirectoryIndex index.html index.php index.jsp
</IfModule>
아파치 /usr/local/apache2/conf 디렉토리에 workers.properties 파일 생성
[root@ruo91 ~]# vi /usr/local/apache2/conf/workers.properties
workers.tomcat_home=$CATALINA_HOME
workers.java_home=$JAVA_HOME
worker.list=ajp13
worker.default.port=8009
worker.default.host=localhost
worker.default.type=ajp13
아파치 가상호스팅 설정
<VirtualHost *:8080>
ServerName jsp.yongbok.net
ServerAdmin ruo91@yongbok.net
ServerAlias jsp.yongbok.net
DocumentRoot /home/ruo91/public_html
ErrorLog /home/apache2-log/jsp-error.log
LogLevel warn
SetEnvIf Remote_Addr 180.224.219.32$ do_not_log
LogLevel warn
CustomLog "/home/apache2-log/jsp-access.log" combined env=!do_not_log
ErrorDocument 403 http://www.yongbok.net/error/permission
ErrorDocument 404 http://www.yongbok.net/error/
Alias /jsp-examples "/usr/local/tomcat/webapps/examples/jsp/"
Alias /servlets-examples "/usr/local/tomcat/webapps/examples/servlets/"
JkMount /jsp-examples/*.jsp ajp13
JkMount /servlets-examples/*.jsp ajp13
<Directory "/home/ruo91/public_html">
Options FollowSymLinks
AllowOverride FileInfo AuthConfig
php_value short_open_tag 0
</Directory>
</VirtualHost>
tomcat-users.xml 에 관리자 계정 추가
[root@yongbok ~]# vi /usr/local/tomcat/conf/tomcat-users.xml
<?xml version='1.0' encoding='utf-8'?>
<!--
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.
-->
<tomcat-users>
<!--
NOTE: By default, no user is included in the "manager-gui" role required
to operate the "/manager/html" web application. If you wish to use this app,
you must define such a user - the username and password are arbitrary.
-->
<!--
NOTE: The sample user and role entries below are wrapped in a comment
and thus are ignored when reading this file. Do not forget to remove
<!.. ..> that surrounds them.
-->
<role rolename="manager-gui"/>
<user username="admin" password="12345" roles="manager-gui"/>
</tomcat-users>
5. 테스트
http://jsp.yongbok.net/manager/html
'6. 리눅스' 카테고리의 다른 글
tar 압축하기/압축풀기 (0) | 2014.10.14 |
---|---|
[리눅스]리눅스 서버에 Apache 2 설치 및 SSL 설정하기(mod_ssl, openssl) (0) | 2011.05.17 |
[리눅스]squirrelMail(다람쥐 메일) 설정 (0) | 2010.10.05 |
리눅스 JDK, tomcat, apach, apache-tomcat 연동 설치 쉘 스크립트 작성 (1) | 2010.10.05 |
[LINUX]smtp 서버 주소 가져오기 (0) | 2010.03.25 |
이 포스팅은 쿠팡 파트너스 활동의 일환으로, 이에 따른 일정액의 수수료를 제공받습니다.