다른 포트 뒤에있는 단일 Tomcat 인스턴스에서 다른 앱을 실행하는 방법은 무엇입니까?
현재 Tomcat 6에서 실행되는 두 개의 웹 응용 프로그램 app1 및 app2가 있습니다.
별도의 포트 뒤의 루트 컨텍스트에서 실행되도록 Tomcat을 구성하고 싶습니다.
무엇을해야합니까?
server.xml 파일 에 구성하고 두 가지 서비스를 넣을 수 있다고 생각합니다 .
<Service name="app1">
<Connector port="8081" protocol="org.apache.coyote.http11.Http11NioProtocol"
connectionTimeout="20000"
redirectPort="8443" />
<Engine name="Catalina" defaultHost="localhost">
<Host name="localhost" appBase="app1"
unpackWARs="true" autoDeploy="true">
</Host>
</Engine>
</Service>
<Service name="app2">
<Connector port="8082" protocol="org.apache.coyote.http11.Http11NioProtocol"
connectionTimeout="20000"
redirectPort="8443" />
<Engine name="Catalina" defaultHost="localhost">
<Host name="localhost" appBase="app2"
unpackWARs="true" autoDeploy="true">
</Host>
</Engine>
</Service>
커넥터 추가의 또 다른 예 :
<Service name="reciver">
<Connector port="8080" maxHttpHeaderSize="8192" maxThreads="10"
enableLookups="false" acceptCount="100"
connectionTimeout="10000" disableUploadTimeout="true"
useBodyEncodingForURI="true"/>
<Engine name="reciver" defaultHost="localhost" jvmRoute="host1">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase" />
<Host name="localhost" appBase="webapps" unpackWARs="true"
autoDeploy="false" xmlValidation="false"
xmlNamespaceAware="false">
<Context docBase="browser" path="/browser" reloadable="false"/>
</Host>
</Engine>
</Service>
<Service name="reciver2">
<Connector port="8081" maxHttpHeaderSize="8192" maxThreads="10"
enableLookups="false" acceptCount="1"
connectionTimeout="10000" disableUploadTimeout="true"
useBodyEncodingForURI="true" proxyName="example.pt" proxyPort="80"/>
<Engine name="reciver2" defaultHost="example_app" jvmRoute="host2">
<Host name="example_app" appBase="test_app/example_app" unpackWARs="true"
autoDeploy="false" xmlValidation="false"
xmlNamespaceAware="false">
<Context docBase="example_app" path="/example_app" reloadable="false"/>
</Host>
</Engine>
</Service>
(...Repeted 2 more times.)
출처 : http://www.coderanch.com/t/84172/Tomcat/listen-multiple-ports
이 구성의 성능 저하와 가능한 경쟁 조건에 대해 이야기하므로 전체 스레드를 읽는 것이 좋습니다.
Besides running two Tomcat instances and using ROOT application (that has already been said and is a bit poor and ineffective solution) you can achieve it by using Apache + Tomcat. Configuring apache to listen to both ports and forward by IP:Port to different Tomcat applications. But you need a different port por tomcat!
Apache configuration
listen 8080,8081
...
<VirtualHost *:8080>
ServerName localhost
ProxyPass / http://localhost:8888/app1
ProxyPassReverse / http://localhost:8080/app1
</VirtualHost>
<VirtualHost *:8081>
ServerName localhost
ProxyPass / http://localhost:8888/app2
ProxyPassReverse / http://localhost:8080/app2
</VirtualHost>
or
listen 80,81
...
<VirtualHost *:80>
ServerName localhost
ProxyPass / http://localhost:8080/app1
ProxyPassReverse / http://localhost:8080/app1
</VirtualHost>
<VirtualHost *:81>
ServerName localhost
ProxyPass / http://localhost:8080/app2
ProxyPassReverse / http://localhost:8080/app2
</VirtualHost>
Tomcat runs on the ports specified in:
$CATALINA_HOME/conf/server.xml
As JB Nizet wrote, setup two different instances of tomcat, and configure the port value server.xml appropriately.
$CATALINA_HOME/tomcat-8081/conf/server.xml:
<?xml version='1.0' encoding='utf-8'?>
<Server port="8081" ... >
...
</Server>
$CATALINA_HOME/tomcat-8082/conf/server.xml:
<?xml version='1.0' encoding='utf-8'?>
<Server port="8082" ... >
...
</Server>
Use two different Tomcat instances.
EDIT:
Or configure Tomcat as explained in the answer of this question: Tomcat configuration help: multiple ports not responding
ReferenceURL : https://stackoverflow.com/questions/8823290/how-to-run-different-apps-on-single-tomcat-instance-behind-different-ports
'Nice programing' 카테고리의 다른 글
R / Shiny로 다이나믹 한 수의 입력 요소 생성 (0) | 2020.12.25 |
---|---|
코드가 널 포인터를 통해 명시 적으로 정적 메서드를 호출하는 이유는 무엇입니까? (0) | 2020.12.25 |
날짜 범위가있는 적절한 REST 형식 URL (0) | 2020.12.25 |
iOS 8 자동 셀 높이-마지막 행으로 스크롤 할 수 없음 (0) | 2020.12.25 |
PHP에서 fopen 모드 "r +"와 "rw +"의 차이점은 무엇입니까? (0) | 2020.12.25 |