nugawiki

./categories/server

Tomcat Context·appBase·docBase

업데이트 2026-07-21 조회수

conf/server.xml<Host appBase>가 웹앱 기준 경로($CATALINA_HOME 상대). 기본 webapps → 루트는 webapps/ROOT.

Context 매핑

<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
    <Context docBase="firstDoc" path="/" reloadable="true" />
    <Context docBase="secondDoc" path="/hello" reloadable="true" />
</Host>
  • path="/"http://host/hello.jspwebapps/firstDoc/hello.jsp
  • path="/hello"http://host/hello/hello.jspwebapps/secondDoc/hello.jsp

웹앱을 루트로

<Context path="" docBase="." reloadable="true"/>

appBase를 다른 경로로

<Host name="localhost" appBase="d:/env/home/my" ...>
    <Context path="" docBase="." reloadable="true"/>
</Host>

Context 생략 시 ROOT가 웹루트.

권장 (5.0+)

server.xml 직접 삽입보다 META-INF/context.xml 또는 conf/Catalina/localhost/앱이름.xml:

<!-- conf/Catalina/localhost/Happy.xml -->
<Context path="/Happy" docBase="C:\Happy"
    privileged="true" antiResourceLocking="false" antiJARLocking="false" />

재시작 후 http://host:포트/Happy/... 확인.

webapps 전체를 웹루트로 쓰는 구성은 보안상 지양.

./comments