๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿ’ป DEV/์—ฐ๊ตฌ๋ชฉ๋ก

[Tomcat] Tomcat ํฌํŠธ ๋ฒˆํ˜ธ ์—ฌ๋Ÿฌ ๊ฐœ ์‚ฌ์šฉํ•˜๊ธฐ, ์ถ”๊ฐ€ํ•˜๊ธฐ(windows)

by Rising Oneโ˜… 2023. 7. 19.
728x90
๋ฐ˜์‘ํ˜•
SMALL

์•„ํŒŒ์น˜ ํ†ฐ์บฃ ๋Œ€ํ‘œ์ด๋ฏธ์ง€

 

ํ•„์š”์„ฑ

์„œ๋น„์Šค ๋ฐฐํฌ๋ฅผ ํ•˜๋ ค๋˜ ๊ณผ์ • ์ค‘์— ์žˆ์Šต๋‹ˆ๋‹ค. ์‚ฌ์šฉํ•˜๋˜ ์ „์šฉ ํฌํŠธ๋Š” ์™ธ๋ถ€์—์„œ๋„, ๋‚ด๋ถ€์—์„œ๋„ ์ ‘๊ทผ์ด ๊ฐ€๋Šฅํ•œ ํฌํŠธ์ธ์ง€๋ผ ์™ธ๋ถ€์—์„œ๋Š” ์ ‘๊ทผ์ด ๋ถˆ๊ฐ€ํ•˜์ง€๋งŒ ๋‚ด๋ถ€์—์„œ๋Š” ์‚ฌ์šฉ์ด ๊ฐ€๋Šฅํ•œ ํฌํŠธ ํ•˜๋‚˜๋ฅผ ํ†ฐ์บฃ ๋‚ด์—์„œ ์ถ”๊ฐ€๋กœ ์—ด์–ด์ฃผ๊ณ ์ž ํ•ฉ๋‹ˆ๋‹ค. ์•„๋ž˜์—์„œ ์ˆœ์„œ๋Œ€๋กœ ๊ทธ ๋ฐฉ๋ฒ•์„ ๊น”๋”ํ•˜๊ฒŒ ์ •๋ฆฌํ•ด๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

 

์ ‘๊ทผ (์š”์•ฝ)

 

  1. Tomcat ์„ค์น˜ ๊ฒฝ๋กœ > conf > server.xml ํŒŒ์ผ ์—ด๊ธฐ

      (1.1). server.xml ์ˆ˜์ • ์ž‘์—…

 

  2. appBase๋กœ ์ง€์ •ํ•  ํด๋” ์ƒ์„ฑ

      (2.1). ํ•˜์œ„์— ROOT ํด๋” ๋ฐ web.xml ์ž‘์—…

 

  3. (ํ•ด์ฃผ์ง€ ์•Š์•„๋„ ๋˜๋Š” ๊ณผ์ • - ์ฐธ๊ณ ) appBase๋กœ ์ง€์ •ํ•œ ํด๋” ํ•˜์œ„ ์ž‘์—…

      (3.1). ํ•˜์œ„์— ROOT ํด๋” ๋ฐ web.xml ์ž‘์—…

 

  4. Tomcat ๊ตฌ๋™ ํ›„ ํด๋” ์ƒ์„ฑ ํ™•์ธ

 

 


๋ฐฉ๋ฒ•

  1. Tomcat ์„ค์น˜ ๊ฒฝ๋กœ > conf > server.xml ํŒŒ์ผ ์—ด๊ธฐ

      (1.1). server.xml ์ˆ˜์ • ์ž‘์—…

      - ์ƒˆ๋กœ ์ถ”๊ฐ€ํ•  port๋ฅผ <Service> ~~ </Service> ์—˜๋ฆฌ๋จผํŠธ๋ฅผ ์ถ”๊ฐ€ํ•ด ์ž‘์„ฑํ•ด์ค๋‹ˆ๋‹ค.

 

# ์•„๋ž˜๋Š” server.xml ๋‚ด ๋ณธ๋ž˜ ์‚ฌ์šฉํ•˜๋˜ 8081ํฌํŠธ์— ๋Œ€ํ•œ <Service> ์—˜๋ฆฌ๋จผํŠธ

  <Service name="Catalina">
    <Connector port="8081" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" URIEncoding="UTF-8" />
    <Engine name="Catalina" defaultHost="localhost">
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase"/>
      </Realm>
      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log" suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b" />
      </Host>
    </Engine>
  </Service>

# ์•„๋ž˜๋Š” server.xml ๋‚ด ์ƒˆ๋กœ์ด ์‚ฌ์šฉํ•  8082ํฌํŠธ์— ๋Œ€ํ•œ <Service> ์—˜๋ฆฌ๋จผํŠธ ์ถ”๊ฐ€

- <Service name ="Catalina2"> ๋ณ€๊ฒฝ

- <Connector port="8082" ๋ณ€๊ฒฝ

- <Engine name ="Catalina2" ๋ณ€๊ฒฝ

- appBase="private_webapps" ๋ณ€๊ฒฝ

  <Service name="Catalina2">
     <Connector port="8082" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8444" URIEncoding="UTF-8" />
     <Engine name="Catalina2" defaultHost="localhost">
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase"/>
      </Realm>
     <Host name="localhost"  appBase="private_webapps"
            unpackWARs="true" autoDeploy="true">
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log" suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b" />
     </Host>
    </Engine>
  </Service>

 

 

  2. appBase๋กœ ์ง€์ •ํ•  ํด๋” ์ƒ์„ฑ : private_webapps

      - appBase๋กœ ์ง€์ •ํ•œ ํด๋”์ธ private_webapps์„ Tomcat ๊ฒฝ๋กœ๋‚ด์— ์ƒ์„ฑ์„ ํ•ด์ค๋‹ˆ๋‹ค. (์ด์™ธ ํด๋”๋Š” ๊ฐ€๋ฆผ์ฒ˜๋ฆฌ)

 

  3. (ํ•ด์ฃผ์ง€ ์•Š์•„๋„ ๋˜๋Š” ๊ณผ์ • - ์ฐธ๊ณ ) appBase๋กœ ์ง€์ •ํ•œ ํด๋” ํ•˜์œ„ ์ž‘์—…

      (3.1). ํ•˜์œ„์— ROOT ํด๋” ๋ฐ WEB-INF ํด๋” (๋ณต์‚ฌ ๋ถ™์—ฌ๋„ฃ๊ธฐ)

 

 

  4. Tomcat ๊ตฌ๋™ ํ›„ ํด๋” ์ƒ์„ฑ ํ™•์ธ


์ด์ƒ์œผ๋กœ, Tomcat ํฌํŠธ๋ฒˆํ˜ธ ์—ฌ๋Ÿฌ ๊ฐœ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ํ•™์Šตํ•ด๋ดค์Šต๋‹ˆ๋‹ค.

์ถ”๊ฐ€ ์งˆ๋ฌธ์„ ๋Œ“๊ธ€์„ ๋‹ฌ์•„์ฃผ์‹œ๋ฉด ๊ฐ์‚ฌํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค^^

์˜ค๋Š˜๋„ ํŒŒ์ดํŒ…์ž…๋‹ˆ๋‹ค! 

728x90
๋ฐ˜์‘ํ˜•
LIST

๋Œ“๊ธ€