SILENTSOFT
Published on

Tomcat 다중 웹 사이트 접속 처리

Authors

도메인 설정 (CNAME 레코드)

DomainCNAME
silentsoft.krsilentsoft.iptime.org
silentsoft.orgsilentsoft.iptime.org

Whois 설정 예시 참조 > https://blog.silentsoft.org/archives/28

Tomcat 서버 설정

{tomcat}\conf\server.xml
<Server ...>
    ...
    <Service name="Catalina">
        ...
        <Engine name="Catalina" ...>
            ...
            <Host name="www.silentsoft.kr" appBase="webapps/silentsoft.kr" unpackWARs="true" autoDeploy="true">
                <Alias>silentsoft.kr</Alias>
                <Valve
                    className="org.apache.catalina.valves.AccessLogValve"
                    directory="logs"
                    prefix="silentsoft.kr_access_log"
                    suffix=".txt"
                    pattern="%h %l %u %t "%r" %s %b" />
            </Host>
            <Host name="www.silentsoft.org" appBase="webapps/silentsoft.org" unpackWARs="true" autoDeploy="true">
                <Alias>silentsoft.org</Alias>
                <Valve
                    className="org.apache.catalina.valves.AccessLogValve"
                    directory="logs"
                    prefix="silentsoft.org_access_log"
                    suffix=".txt"
                    pattern="%h %l %u %t "%r" %s %b" />
            </Host>
        </Engine>
    </Service>
</Server>

{tomcat}\webapps directory 구조

webapps
+---silentsoft.kr
    \---ROOT
            index.html
+---silentsoft.org
    \---ROOT
            index.html