728x90
반응형
Tomcat 설치
- 다운로드 사이트
https://tomcat.apache.org/download-10.cgi
# wget https://dlcdn.apache.org/tomcat/tomcat-10/v10.1.19/bin/apache-tomcat-10.1.19.tar.gz
# tar -xvf apache-tomcat-10.1.19.tar.gz
# mv /root/apache-tomcat-10.1.19 /root/tomcat
# /root/tomcat/bin/./start.sh --> 8080 포트 LISTEN 확인
# netstat -ntpa |grep 8080
tcp6 0 0 :::8080 :::* LISTEN 9743/java
- 웹페이지 접속확인(default page)
- Server Status, Manager App, Host Manager 기능은 보안 문제로 기본적으로 막혀 있음, 접속시 403 Access Denied 해결
- 중단부분에 Tomcat Setup, JDBC DataSources 등 doc, sample 등도 클릭하면 403 Access Denied
# 1. conf 디렉토리 tomcat-users.xms 설정 변경
# vi /root/tomcat/conf/tomcat-users.xml
- 제일 아래 username / password 도 admin/amdin 으로 변경함
<tomcat-users xmlns="http://tomcat.apache.org/xml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
version="1.0">
<role rolename="admin"/>
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<role rolename="manager"/>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<user username="admin" password="admin" roles="admin,manager,admin-gui,admin-script,manager-gui,manager-script,manager-jmx,manager-status" />
# 2. /root/tomcat/webapp/아래 context.xml 설정 변경
# ls /root/tomcat/webapps/
context.xml docs examples host-manager manager ROOT SampleWebApp SampleWebApp.war
# /root/tomcat/webapps/ 아래 context.xml 파일을 찾아서 다 바꿔줘야 됨
# find . -name context.xml
./docs/META-INF/context.xml
./examples/META-INF/context.xml
./host-manager/META-INF/context.xml
./manager/META-INF/context.xml
./SampleWebApp/META-INF/context.xml
./context.xml
# tree docs
docs
└── META-INF
└── context.xml
exaples
└── META-INF
└── context.xml
host-manager
└── META-INF
└── context.xml
manager
└── META-INF
└── context.xml
SampleWebApp
└── META-INF
└── context.xml
- 변경 예
# vi /root/tomcat/webapps/manager/META-INF/context.xml
<?xml version="1.0" encoding="UTF-8"?>
<Context antiResourceLocking="false" privileged="true" >
<CookieProcessor className="org.apache.tomcat.util.http.Rfc6265CookieProcessor"
sameSiteCookies="strict" />
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
#------> allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
<Manager sessionAttributeValueClassNameFilter="java\.lang\.(?:Boolean|Integer|Long|Number|String)|org\.apache\.catalina\.filters\.CsrfPreventionFilter\$LruCache(?:\$1)?|java\.util\.(?:Linked)?HashMap"/>
</Context>
# allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" /> 를
# allow=".*" /> 으로 변경
# 3. Tomcat 재기동후 접속확인 (8080 포트가 정상적으로 올라왔는지 확인)
# /root/tomcat/bin/./shutdown.sh
Using CATALINA_BASE: /root/tomcat
Using CATALINA_HOME: /root/tomcat
Using CATALINA_TMPDIR: /root/tomcat/temp
Using JRE_HOME: /usr/lib/jvm/java-17-openjdk-17.0.1.0.12-2.el8_5.x86_64
Using CLASSPATH: /root/tomcat/bin/bootstrap.jar:/root/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS: -javaagent:/root/tomcat/jmx_exporter/jmx_prometheus_javaagent-0.17.0.jar=8081:/root/tomcat/jmx_exporter/config.yaml
# /root/tomcat/bin/./startup.sh
Using CATALINA_BASE: /root/tomcat
Using CATALINA_HOME: /root/tomcat
Using CATALINA_TMPDIR: /root/tomcat/temp
Using JRE_HOME: /usr/lib/jvm/java-17-openjdk-17.0.1.0.12-2.el8_5.x86_64
Using CLASSPATH: /root/tomcat/bin/bootstrap.jar:/root/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS: -javaagent:/root/tomcat/jmx_exporter/jmx_prometheus_javaagent-0.17.0.jar=8081:/root/tomcat/jmx_exporter/config.yaml
Tomcat started.
# netstat -ntpa |grep LISTEN
tcp6 0 0 127.0.0.1:8005 :::* LISTEN 12226/java
tcp6 0 0 :::8080 :::* LISTEN 12226/java
tcp6 0 0 :::8081 :::* LISTEN 12226/java
- Server Status
- Manager App
- Host Manager
728x90
반응형
LIST
'programming > java' 카테고리의 다른 글
JAVA Version 업그레이드 (0) | 2024.02.29 |
---|