- 서블릿 인터페이스의 구현체
- 서블릿 컨테이너중 하나
# 톰캣 폴더 경로
cd bin
# 맥북은 sh, 윈도우는 bat
# 톰캣 실행
./startup.sh
# 톰캣 종료
./shutdown.sh
tomcat 9버전 - 톰캣 9.0 버전 , 맥북은 tar.gz, 윈도우는 zip
Apache Tomcat® - Apache Tomcat 9 Software Downloads
Welcome to the Apache Tomcat® 9.x software download page. This page provides download links for obtaining the latest version of Tomcat 9.0.x software, as well as links to the archives of older releases. Unsure which version you need? Specification version
tomcat.apache.org
폴더 생성 후 main 클래스 → WebApplicationServer로 바꿈
- 톰캣 9버전은 javaEE 버전
- 톰캣 10버전은 jakartaEE
<aside> 💡 build.gradle - dependency 라이브러리 필요 </aside>
org.example 밑에 클래스를 톰캣이 실행될 때 classes 밑에서 자바 클래스를 찾아 실행
war 배포하기
[인텔리J] war 파일 배포하기
File > Proejct Structure 접속 Artifacts > 가운데 + 버튼 클릭 > Web Application Archive >For 'untitled:war exploded 클릭 생성된 워파일을 아래와 같이 test로 Name과 war 파일명 이름을 변경해준다.(원하는 이름으로 변
xzio.tistory.com
context 추가하기
// server.xml
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
// context - docBase는 war파일 이름, path는 주소
<Context path="/" docBase="aaa" reloadable="true"/>
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>
<Host name="www.miniboard.com" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<Context path="/" docBase="aaa" reloadable="true"/>
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>
도메인 사용시
- 우선 <Connector port="8080" protocol="HTTP/1.1" 부분의 port를 80으로 수정한다.
- 도메인명이 기본으로 80포트를 사용하기 때문이다.
// server.xml
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
maxParameterCount="1000"
/>
/etc/hosts 수정하기
Mac에서 Apache와 Tomcat 연동하기
mac환경에서 apache와 tomcat을 연동하고자 한다. Apache를 별도로 설치하고자 했지만 Mac에는 이미 포함되어 있다. 세팅 환경 MacOS Sierra 10.12 apachectl -v 명령어로 버전확인 Apache 2.4.23 Tomcat 8.5.11 localhost:80
flowarc.tistory.com
sudo vi /etc/hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
127.0.0.1 test.com // 내가 설정하고자하는 도메인 주소
255.255.255.255 broadcasthost
::1 localhost
'Backend > Spring' 카테고리의 다른 글
SpringBoot 3버전 Swagger 적용하기 (0) | 2023.12.14 |
---|---|
스프링 빌드 안될 때 (0) | 2023.12.13 |
스프링 부트 - 터미널에서 빌드하는 법 (0) | 2023.02.25 |
스프링 부트 - 서버 재시작 없이 파일 변경 후 업데이트 하는 법 (0) | 2023.02.25 |
스프링 - 프로젝트 생성 및 템플릿 엔진 사용하기 (0) | 2023.02.25 |
댓글