apache, tomcat 가상호스트 추가 및 맵핑
Apache, Tomcat VirtualHost setting
apache, tomcat 가상호스트 추가 및 맵핑
1. 가상호스트 설정을 위한 Include 주석 해제
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
2. VirtualHost 도메인 설정
# httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "/WAS/apps/test1"
ServerName AAA.test.com
ErrorLog "logs/aaa-error_log"
CustomLog "logs/aaa-access_log" common
JkMount * aaa
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/WAS/apps/test2"
ServerName BBB.test.com
ErrorLog "logs/bbb-error_log"
CustomLog "logs/bbb-access_log" common
JkMount * bbb
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/WAS/apps/test3"
ServerName CCC.test.com
ErrorLog "logs/ccc-error_log"
CustomLog "logs/ccc-access_log" common
JkMount * ccc
</VirtualHost>
3. 각각의 도메인과 맵핑될 톰캣 정보 추가
# workers.properties list
worker.aaa.port=8009
worker.aaa.host=localhost
worker.aaa.type=ajp13
worker.bbb.port=8010
worker.bbb.host=localhost
worker.bbb.type=ajp13
worker.ccc.port=8011
worker.ccc.host=localhost
worker.ccc.type=ajp13
4. 톰캣 Catalina 추가
# server.xml
<Service name="CatalinaA">
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" maxThreads="150" SSLEnabled="true" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" />
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
<Engine name="CatalinaA" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
</Realm>
<Host name="localhost" appBase="/WAS/apps/aaa" unpackWARs="true" autoDeploy="true">
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
<!-- <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
-->
<Context path="" docBase="." reloadable="true"/>
</Host>
</Engine>
</Service>
<Service name="CatalinaB">
<Connector port="8081" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8444" />
<Connector port="8444" protocol="org.apache.coyote.http11.Http11NioProtocol" maxThreads="150" SSLEnabled="true" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" />
<Connector port="8010" protocol="AJP/1.3" redirectPort="8443" />
<Engine name="CatalinaB" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
</Realm>
<Host name="localhost" appBase="/WAS/apps/bbb" unpackWARs="true" autoDeploy="true">
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
<!-- <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
-->
<Context path="" docBase="." reloadable="true"/>
</Host>
</Engine>
</Service>
<Service name="CatalinaC">
<Connector port="8082" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8445" />
<Connector port="8445" protocol="org.apache.coyote.http11.Http11NioProtocol" maxThreads="150" SSLEnabled="true" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" />
<Connector port="8011" protocol="AJP/1.3" redirectPort="8443" />
<Engine name="CatalinaC" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
</Realm>
<Host name="localhost" appBase="/WAS/apps/ccc" unpackWARs="true" autoDeploy="true">
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
<!-- <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
-->
<Context path="" docBase="." reloadable="true"/>
</Host>
</Engine>
</Service>
apache, tomcat 가상호스트 추가 및 맵핑
1. 가상호스트 설정을 위한 Include 주석 해제
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
2. VirtualHost 도메인 설정
# httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "/WAS/apps/test1"
ServerName AAA.test.com
ErrorLog "logs/aaa-error_log"
CustomLog "logs/aaa-access_log" common
JkMount * aaa
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/WAS/apps/test2"
ServerName BBB.test.com
ErrorLog "logs/bbb-error_log"
CustomLog "logs/bbb-access_log" common
JkMount * bbb
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/WAS/apps/test3"
ServerName CCC.test.com
ErrorLog "logs/ccc-error_log"
CustomLog "logs/ccc-access_log" common
JkMount * ccc
</VirtualHost>
3. 각각의 도메인과 맵핑될 톰캣 정보 추가
# workers.properties list
worker.aaa.port=8009
worker.aaa.host=localhost
worker.aaa.type=ajp13
worker.bbb.port=8010
worker.bbb.host=localhost
worker.bbb.type=ajp13
worker.ccc.port=8011
worker.ccc.host=localhost
worker.ccc.type=ajp13
4. 톰캣 Catalina 추가
# server.xml
<Service name="CatalinaA">
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" maxThreads="150" SSLEnabled="true" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" />
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
<Engine name="CatalinaA" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
</Realm>
<Host name="localhost" appBase="/WAS/apps/aaa" unpackWARs="true" autoDeploy="true">
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
<!-- <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
-->
<Context path="" docBase="." reloadable="true"/>
</Host>
</Engine>
</Service>
<Service name="CatalinaB">
<Connector port="8081" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8444" />
<Connector port="8444" protocol="org.apache.coyote.http11.Http11NioProtocol" maxThreads="150" SSLEnabled="true" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" />
<Connector port="8010" protocol="AJP/1.3" redirectPort="8443" />
<Engine name="CatalinaB" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
</Realm>
<Host name="localhost" appBase="/WAS/apps/bbb" unpackWARs="true" autoDeploy="true">
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
<!-- <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
-->
<Context path="" docBase="." reloadable="true"/>
</Host>
</Engine>
</Service>
<Service name="CatalinaC">
<Connector port="8082" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8445" />
<Connector port="8445" protocol="org.apache.coyote.http11.Http11NioProtocol" maxThreads="150" SSLEnabled="true" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" />
<Connector port="8011" protocol="AJP/1.3" redirectPort="8443" />
<Engine name="CatalinaC" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
</Realm>
<Host name="localhost" appBase="/WAS/apps/ccc" unpackWARs="true" autoDeploy="true">
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
<!-- <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
-->
<Context path="" docBase="." reloadable="true"/>
</Host>
</Engine>
</Service>
* docBase context root 설정이 안먹는 경우 docBase="/WAS/apps/ccc" 절대경로 설정
5. Test
0 Comments:
댓글 쓰기