Home > Server > ๐Ÿง‘โ€๐Ÿ’ป[Server] Tomcat์ด๋ž€ ๋ฌด์—‡์ผ๊นŒ์š”?

๐Ÿง‘โ€๐Ÿ’ป[Server] Tomcat์ด๋ž€ ๋ฌด์—‡์ผ๊นŒ์š”?
Server

๐Ÿง‘โ€๐Ÿ’ป[Server] Tomcat์ด๋ž€ ๋ฌด์—‡์ผ๊นŒ์š”?

  • Tomcat์€ Apache Software Foundation์—์„œ ๊ฐœ๋ฐœ ๋ฐ ์œ ์ง€๋ณด์ˆ˜ํ•˜๋Š” Java ๊ธฐ๋ฐ˜์˜ ์›น ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์„œ๋ฒ„(WAS, Web Application Server)์ž…๋‹ˆ๋‹ค.
    • ์ •์‹ ๋ช…์นญ์€ Apache Tomcat์ด๋ฉฐ, ์„œ๋ธ”๋ฆฟ(Servlet)๊ณผ JSP(JavaSserver Page) ๊ธฐ์ˆ ์„ ์ง€์›ํ•˜๋Š” ๊ฐ€์žฅ ๋„๋ฆฌ ์‚ฌ์šฉ๋˜๋Š” WAS ์ค‘ ํ•˜๋‚˜์ž…๋‹ˆ๋‹ค.

1๏ธโƒฃ Tomcat์˜ ์ฃผ์š” ์—ญํ• .

  • Tomcat์€ Java EE(Java Platform, Enterprise Edition)์˜ ์ผ๋ถ€์ธ ์„œ๋ธ”๋ฆฟ๊ณผ JSP๋ฅผ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋Š” ํ™˜๊ฒฝ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.
    • ์ด๋ฅผ ํ†ตํ•ด ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์ž‘์—…์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.
      • HTTP ์š”์ฒญ ์ฒ˜๋ฆฌ : HTTP ํด๋ผ์ด์–ธํŠธ(๋ธŒ๋ผ์šฐ์ €)๋กœ๋ถ€ํ„ฐ ์š”์ฒญ์„ ๋ฐ›์•„ ์ฒ˜๋ฆฌํ•˜๊ณ  ์‘๋‹ต์„ ๋ณด๋ƒ…๋‹ˆ๋‹ค.
      • ์„œ๋ธ”๋ฆฟ ์‹คํ–‰ : Java Servlet์€ ์„œ๋ฒ„ ์ธก์—์„œ ์‹คํ–‰๋˜๋Š” Java ํ”„๋กœ๊ทธ๋žจ์œผ๋กœ, ๋™์ ์ธ ์›น ์ฝ˜ํ…์ธ ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
      • JSP ์‹คํ–‰ : JSP(JavaServer Page)๋Š” HTML ๋ฌธ์„œ์— Java ์ฝ”๋“œ๋ฅผ ์‚ฝ์ž…ํ•˜์—ฌ ๋™์ ์ธ ์›น ์ฝ˜ํ…์ธ ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
      • ์ƒˆ์…˜ ๊ด€๋ฆฌ : ์‚ฌ์šฉ์ž์˜ ์ƒํƒœ๋ฅผ ์œ ์ง€ํ•˜๊ธฐ ์œ„ํ•œ ์„ธ์…˜(Session)์„ ๊ด€๋ฆฌํ•ฉ๋‹ˆ๋‹ค.
      • HTTP/HTTPS ์ง€์› : HTTP ๋ฐ HTTPS ํ”„๋กœํ† ์ฝœ์„ ํ†ตํ•ด ์›น ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜๊ณผ ํด๋ผ์ด์–ธํŠธ ๊ฐ„์˜ ํ†ต์‹ ์„ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค.

2๏ธโƒฃ Tomcat์˜ ์ฃผ์š” ๊ตฌ์„ฑ ์š”์†Œ.

  • Tomcat์€ ์—ฌ๋Ÿฌ ๊ตฌ์„ฑ ์š”์†Œ๋กœ ์ด๋ฃจ์–ด์ ธ ์žˆ์œผ๋ฉฐ, ๊ฐ ์š”์†Œ๋Š” ํŠน์ • ์—ญํ• ์„ ๋‹ด๋‹นํ•ฉ๋‹ˆ๋‹ค.

1๏ธโƒฃ Catalina

  • Tomcat์˜ ํ•ต์‹ฌ์ธ ์„œ๋ธ”๋ฆฟ ์ปจํ…Œ์ด๋„ˆ์ž…๋‹ˆ๋‹ค.
  • ์„œ๋ธ”๋ฆฟ์„ ๋กœ๋“œํ•˜๊ณ  ์‹คํ–‰ํ•˜๋ฉฐ, HTTP ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค.

2๏ธโƒฃ Coyote

  • HTTP ์ปค๋„ฅํ„ฐ๋กœ, ํด๋ผ์ด์–ธํŠธ์˜ HTTP ์š”์ฒญ์„ ๋ฐ›์•„ Catalina์— ์ „๋‹ฌํ•ฉ๋‹ˆ๋‹ค.
  • HTTP/1.1 ๋ฐ HTTPS๋ฅผ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.

3๏ธโƒฃ Jasper

  • JSP ์—”์ง„์œผ๋กœ, JSP ํŒŒ์ผ์„ ์„œ๋ธ”๋ฆฟ์œผ๋กœ ๋ณ€ํ™˜ํ•˜๊ณ  ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

4๏ธโƒฃ Cluster

  • ํด๋Ÿฌ์Šคํ„ฐ๋ง ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•˜์—ฌ ์—ฌ๋Ÿฌ Tomcat ์„œ๋ฒ„ ๊ฐ„์˜ ์„ธ์…˜ ๋ฐ์ดํ„ฐ๋ฅผ ๊ณต์œ ํ•ฉ๋‹ˆ๋‹ค.

5๏ธโƒฃ Web Application

  • Tomcat์— ๋ฐฐํฌ๋œ ์›น ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๊ด€๋ฆฌํ•˜๊ณ  ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.
  • WAR ํŒŒ์ผ(Web Application Archive) ํ˜•์‹์œผ๋กœ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๋ฐฐํฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

3๏ธโƒฃ Tomcat์˜ ํŠน์ง•.

1๏ธโƒฃ ๊ฒฝ๋Ÿ‰ํ™”๋œ ์„œ๋ฒ„.

  • Tomcat์€ WAS ์ค‘์—์„œ๋„ ๊ฐ€๋ณ๊ณ  ์„ค์น˜ ๋ฐ ์‹คํ–‰์ด ์‰ฝ์Šต๋‹ˆ๋‹ค.

2๏ธโƒฃ ๋ฌด๋ฃŒ ๋ฐ ์˜คํ”ˆ์†Œ์Šค.

  • Apache Software Foundation์ด ๊ด€๋ฆฌํ•˜๋ฉฐ, ๋ˆ„๊ตฌ๋‚˜ ๋ฌด๋ฃŒ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

3๏ธโƒฃ ์„œ๋ธ”๋ฆฟ๊ณผ JSP ํ‘œ์ค€ ์ง€์›.

  • Java EE ํ‘œ์ค€ ๊ธฐ์ˆ ์„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.

4๏ธโƒฃ ํ™•์žฅ ๊ฐ€๋Šฅ์„ฑ.

  • ๋‹ค์–‘ํ•œ ์ถ”๊ฐ€ ๋ชจ๋“ˆ๊ณผ ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ํ†ตํ•ด ํ™•์žฅํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

5๏ธโƒฃ ์œ ์—ฐ์„ฑ.

  • ํ•„์š”์— ๋”ฐ๋ผ ์„ค์ •๊ณผ ๊ตฌ์„ฑ์„ ์‰ฝ๊ฒŒ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

4๏ธโƒฃ Tomcat์˜ ์ž‘๋™ ๋ฐฉ์‹.

1๏ธโƒฃ ์š”์ฒญ ์ˆ˜์‹ .

  • Coyote๊ฐ€ ํด๋ผ์ด์–ธํŠธ๋กœ๋ถ€ํ„ฐ HTTP ์š”์ฒญ์„ ์ˆ˜์‹ ํ•ฉ๋‹ˆ๋‹ค.

2๏ธโƒฃ ์„œ๋ธ”๋ฆฟ ์ฒ˜๋ฆฌ.

  • Catalina๊ฐ€ ์š”์ฒญ์„ ๋ถ„์„ํ•˜์—ฌ ์ ์ ˆํ•œ ์„œ๋ธ”๋ฆฟ์„ ํ˜ธ์ถœํ•ฉ๋‹ˆ๋‹ค.
  • ์„œ๋ธ”๋ฆฟ์ด ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•˜๊ณ  ๊ฒฐ๊ณผ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

3๏ธโƒฃ JSP ์ฒ˜๋ฆฌ.

  • ์š”์ฒญ๋œ JSP ํŒŒ์ผ์ด ์žˆ๋‹ค๋ฉด Jasper๊ฐ€ ์ด๋ฅผ ์„œ๋ธ”๋ฆฟ์œผ๋กœ ๋ณ€ํ™˜ํ•ฉ๋‹ˆ๋‹ค.
  • ๋ณ€ํ™˜๋œ ์„œ๋ธ”๋ฆฟ์ด ์‹คํ–‰๋˜์–ด ๊ฒฐ๊ณผ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

4๏ธโƒฃ ์‘๋‹ต ๋ฐ˜ํ™˜.

  • ์ฒ˜๋ฆฌ ๊ฒฐ๊ณผ๋ฅผ HTTP ์‘๋‹ต์œผ๋กœ ํด๋ผ์ด์–ธํŠธ์— ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

5๏ธโƒฃ Tomcat์˜ ์žฅ๋‹จ์ .

1๏ธโƒฃ ์žฅ์ .

  • ๊ฐ€๋ฒผ์›€ : ํ’€ ์Šคํƒ Java EE ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์„œ๋ฒ„(์˜ˆ: WildFly, WebLogic)๋ณด๋‹ค ๊ฐ€๋ณ๊ณ  ๋น ๋ฆ…๋‹ˆ๋‹ค.
  • ๋ฌด๋ฃŒ : ์ƒ์šฉ WAS ๋Œ€๋น„ ๋น„์šฉ์ด ๋“ค์ง€ ์•Š์Šต๋‹ˆ๋‹ค.
  • ์‚ฌ์šฉ ์šฉ์ด์„ฑ : ์„ค์น˜์™€ ์„ค์ •์ด ๊ฐ„๋‹จํ•˜๋ฉฐ, ๊ฐœ๋ฐœ ๋ฐ ํ…Œ์ŠคํŠธ ํ™˜๊ฒฝ์—์„œ ์ž์ฃผ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.
  • ์ปค๋ฎค๋‹ˆํ‹ฐ ์ง€์› : ์˜คํ”ˆ์†Œ์Šค ํ”„๋กœ์ ํŠธ๋กœ ์ปค๋ฎค๋‹ˆํ‹ฐ์—์„œ ๋‹ค์–‘ํ•œ ๋„์›€๊ณผ ์ž๋ฃŒ๋ฅผ ์ œ๊ณต๋ฐ›์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

2๏ธโƒฃ ๋‹จ์ .

  • ๊ธฐ๋Šฅ ์ œํ•œ : Java EE์˜ ๋ชจ๋“  ํ‘œ์ค€(์˜ˆ: EJB, JCA)์„ ์ง€์›ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์ด๋Š” WildFly, WebLogic๊ณผ ๊ฐ™์€ ํ’€ ์Šคํƒ WAS์™€์˜ ์ฃผ์š” ์ฐจ์ด์ ์ž…๋‹ˆ๋‹ค.
  • ๊ณ ๊ธ‰ ๊ธฐ๋Šฅ ๋ถ€์กฑ : ์—”ํ„ฐํ”„๋ผ์ด์ฆˆ๊ธ‰ ๊ธฐ๋Šฅ(ํŠธ๋žœ์žญ์…˜ ๊ด€๋ฆฌ, ๋ฉ”์‹œ์ง• ๋“ฑ)์ด ๋ถ€์กฑํ•ฉ๋‹ˆ๋‹ค.

6๏ธโƒฃ Tomcat์ด ์ฃผ๋กœ ์‚ฌ์šฉ๋˜๋Š” ์‚ฌ๋ก€.

  • ๊ฐœ๋ฐœ ๋ฐ ํ…Œ์ŠคํŠธ ํ™˜๊ฒฝ : ๊ฐ€๋ณ๊ณ  ๋น ๋ฅด๊ธฐ ๋•Œ๋ฌธ์— ๊ฐœ๋ฐœ ๋‹จ๊ณ„์—์„œ ๋งŽ์ด ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.
  • ์†Œ๊ทœ๋ชจ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ : ํฐ ๋ถ€ํ•˜๊ฐ€ ์—†๋Š” ๊ฐ„๋‹จํ•œ ์›น ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์—์„œ ๋งŽ์ด ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.
  • Spring Boot ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ : Spring Boot๋Š” Tomcat์„ ๊ธฐ๋ณธ ๋‚ด์žฅ ์„œ๋ฒ„๋กœ ์‚ฌ์šฉํ•˜์—ฌ JAR ํŒŒ์ผ๋กœ ์‹คํ–‰ ๊ฐ€๋Šฅํ•˜๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค.

7๏ธโƒฃ Tomcat์˜ ๋ฐฐํฌ ๋ฐฉ๋ฒ•.

1๏ธโƒฃ WAR ํŒŒ์ผ ๋ฐฐํฌ.

  • webapps/ ๋””๋ ‰ํ„ฐ๋ฆฌ์— WAR ํŒŒ์ผ์„ ๋ณต์‚ฌํ•ฉ๋‹ˆ๋‹ค.
  • Tomcat์ด ์ž๋™์œผ๋กœ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๋กœ๋“œํ•ฉ๋‹ˆ๋‹ค.

2๏ธโƒฃ JAR ํŒŒ์ผ ์‹คํ–‰.

  • Spring Boot์™€ ๊ฐ™์€ ํ”„๋ ˆ์ž„์›Œํฌ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ JAR ํŒŒ์ผ ํ˜•ํƒœ๋กœ ๋ฐฐํฌ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. ์ด ๊ฒฝ์šฐ ๋‚ด์žฅ Tomcat์ด ํฌํ•จ๋ฉ๋‹ˆ๋‹ค.

3๏ธโƒฃ ์„ค์ • ํŒŒ์ผ ์‚ฌ์šฉ.

  • server.xml ๋ฐ web.xml์„ ์‚ฌ์šฉํ•˜์—ฌ ์„œ๋ฒ„์™€ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์„ค์ •์„ ์กฐ์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

8๏ธโƒฃ ๊ฒฐ๋ก .

  • Tomcat์€ ์„œ๋ธ”๋ฆฟ๊ณผ JSP ๊ธฐ์ˆ ์„ ๊ธฐ๋ฐ˜์œผ๋กœ ํ•œ Java ์›น ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์„œ๋ฒ„๋กœ, ๊ฒฝ๋Ÿ‰ํ™”์™€ ์‚ฌ์šฉ ์šฉ์ด์„ฑ ๋•๋ถ„์— ๋งŽ์€ ๊ฐœ๋ฐœ์ž๊ฐ€ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
  • ํŠนํžˆ ๊ฐœ๋ฐœ ๋ฐ ํ…Œ์ŠคํŠธ ํ™˜๊ฒฝ์—์„œ ์ธ๊ธฐ๊ฐ€ ๋†’์œผ๋ฉฐ, Spring Boot์™€ ๊ฐ™์€ ์ตœ์‹  ํ”„๋ ˆ์ž„์›Œํฌ์—์„œ๋„ ๋‚ด์žฅ WAS๋กœ ํ™œ์šฉ๋ฉ๋‹ˆ๋‹ค.