본문 바로가기
Framework/Spring

[Spring] 내장된 톰캣서버 port 변경 방법 (Eclipse+Spring+Maven) /톰캣 포트 변경/tomcat port change

by 나비와꽃기린 2016. 10. 11.

1. Servers



2. 웹서버설정 파일 servers.xml

웹서버 설정 정보와 함께, 현재 STS 메뉴 트리에 있는 Project들의 Context정보가 들어있음.

<Connector>관련 부분에 port관련 설정이 있음을 확인 할 수 있는데 변수들이

${}로 처리되고 있다.

이 변수들은 catalina.properties에서 관리가 된다.

<?xml version="1.0" encoding="UTF-8"?>
<Server port="${base.shutdown.port}" shutdown="SHUTDOWN">
    <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
    <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
    <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>
    <Listener className="com.springsource.tcserver.serviceability.deploy.TcContainerDeployer"/>
    <Listener accessFile="${catalina.base}/conf/jmxremote.access" address="127.0.0.1" authenticate="true" className="com.springsource.tcserver.serviceability.rmi.JmxSocketListener" passwordFile="${catalina.base}/conf/jmxremote.password" port="${base.jmx.port}" useSSL="false"/>
    <GlobalNamingResources>
        <Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/>
    </GlobalNamingResources>
    <Service name="Catalina">
        <Executor maxThreads="300" minSpareThreads="50" name="tomcatThreadPool" namePrefix="tomcat-http--"/>
        <Engine defaultHost="localhost" name="Catalina">
            <Realm className="org.apache.catalina.realm.LockOutRealm">
                <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
            </Realm>
            <Host appBase="webapps" autoDeploy="true" deployOnStartup="true" deployXML="true" name="localhost" unpackWARs="true">
                <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log." suffix=".txt"/>
            <Context docBase="StsProject" path="/sts" reloadable="true" source="org.eclipse.jst.jee.server:StsProject"/>
            <Context docBase="1010_Spring" path="/spring" reloadable="true" source="org.eclipse.jst.jee.server:1010_Spring"/></Host>
        </Engine>
        <Connector acceptCount="100" connectionTimeout="20000" executor="tomcatThreadPool" maxKeepAliveRequests="15" port="${bio.http.port}" protocol="org.apache.coyote.http11.Http11Protocol" redirectPort="${bio.https.port}"/>
    </Service>
</Server>


3. catalina.properties


bio.http.port를 필자는 8080을 8989로 바꿨었음.



4. 설정파일을 변경하면 STS 를 종료하고 다시 시작합니당.


댓글0