본문 바로가기

서버

[Apache-Tomcat] Tomcat Context 경로 설정

conf폴더 내의 server.xml파일에서 <Host>내의 <Context>에서 파일경로의 변경이 가능

<Host name="localhost"  appBase="webapps"
      unpackWARs="true" autoDeploy="true">

    <Context docBase="firstDoc" path="/" reloadable="true" />
    <Context docBase="secondDoc" path="/hello" reloadable="true" />

</Host>

<Host>태그 의 name에서 host를 설정 가능하다.

위의 예시의 경우 appBase로 부터 시작하는 상대경로이므로 [Tomcat 설치디렉토리]/webapps가 기본 디렉토리가 된다.

<Host>태그 내에 있는 윗줄 <Context>태그를 본다면

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

http://localhost/hello.jsp 를 요청할 경우, http://localhost/firstDoc/hello.jsp 을 출력한다.

두 번째 예시로

<Context docBase="secondDoc" path="/hello" reloadable="true" />

http://localhost/hello/hello.jsp 를 요청할 경우, http://localhost/secondDoc/hello.jsp 을 출력한다.

 

'서버' 카테고리의 다른 글

파일 업로드를 위한 apache-tomcat 설정  (0) 2024.03.14
[Tomcat] 심볼릭 링크 가능 설정  (0) 2024.01.08
[Linux] 심볼릭 링크 변경하기  (0) 2024.01.08
certbot renew 갱신  (1) 2022.09.19
gitlab 명령어 및 에러  (0) 2022.08.11