-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Vinu,
On 9/19/19 06:26, Vinu Vibhu Sobhana wrote: > Hai, > > Iam having two Web Servers configured to run Tomcat8.5. My project > manager had assigned me to configure these Tomcat Web Servers in > cluster mode so that the sessions will be managed by the Tomcat > Cluster. The same had been done using tomcat > references/documentation. I have also configured a Hardware LB so > that the VIP may balance the request accessing the URL "http://<IP > ADDRESS>/test". > > But now he had asked to tweak the existing configuration so as to > host multiple application under domain-name basis. Upon verifying > the tomcat documentation, I understood that Host Manager feature of > tomcat can be used for such virtual hosting. You can configure virtual hosting merely by configuring several <Host> entries in conf/server.xml. Ths host manager may not be necessary. > I had tried configuring Tomcat Cluster for Virtual-Hosts, but needs > to confirm whether my approach is correct. Please find my queries > and server.xml files listed below. > > 1. Do I need to configure Multiple Cluster class for each > Virtual-Host or a Single Cluster class is enough to manage all > Virtual-Hosts. A single cluster can be configured in conf/server.xml that will cover all virtual hosts in an <Engine> if you make sure to configure the <Cluster> as a child of the <Engine> element. If you'd like separate <Cluster> configurations for each virtual host, you may configure sepearate <Cluster> elements as child elements of each <Host> element. > 2. While using the Hardware LB with "X-Forwarded-for" enabled, how > can I get the Client IPs listed in the log file using > RemoteIpValve. You will want to enable the RemoteIPValve. You can read about it here: http://tomcat.apache.org/tomcat-8.5-doc/config/valve.html#Remote_IP_Valv e > Should it also be configured Globally or per Virtual-Host basis. That's up to you. If you intend to use your LB for all virtual hosts (which is usually a good idea for HA), then configure it globally. > My server.xml file for both the nodes are mentioned below for > reference. > > server.xml for node1 ################### <?xml version="1.0" > encoding="UTF-8"?> <Server port="8105" shutdown="SHUTDOWN"> [snip] > <Service name="Catalina"> <snip> <Engine name="Catalina" > defaultHost="localhost" jvmRoute="jvm18"> <Host name="localhost" > appBase="webapps" unpackWARs="true" autoDeploy="true"> [snip] <!-- > ############################################ VIRTUAL HOST START > ###################################################################### #########--> Note > that the first (default) <Host> is also a VirtualHost. > <Host name="newapps.com" appBase="app-dir" unpackWARs="true" > autoDeploy="true"> <Alias>www.newapps.com</Alias> > > <!--################################################## TOMCAT > CLUSTERED BEGIN ########################################### --> > <Cluster This will define a host-specific cluster. If you want the same cluster to handle all virtual hosts, then define it one level higher, under <Engine>. You may want to consider using HTTPS internally on your network instead of (plaintext) HTTP, and you may also want to consider enabling the EncryptionInterceptor for your cluster. That way, none of your internal communications are in the clear vulnerable to interception or modification within your network. Hope that helps, - -chris -----BEGIN PGP SIGNATURE----- Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/ iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl2I5QwACgkQHPApP6U8 pFirtw//S3kxxhokYuOEG/434ZMnsV9U3WiOhjt1l7eJoyIqloBeHwca62Irj2mA Pq8FliTJBJYtwCnsK6BLZj9xrnaLJpEf4iVYhkV5ICq6M3ZLJrYzHnuPApn3KlaO 6/9M2+sSQb978Tao1Wy8KNdIFwqP6KRcA/HuPwEwZR987EtGSRgglh3limyFmif1 ZXiz/Vy0+FyjrUhMmhF/2oaWVQ5grKIJ3kvRewYbUxFvGFe0z5i9rlMQnW3rvG/H mGWNYosXMTBdqzbT5mB182xRNU2Fwv2oxIAZCf0Ucnruap61BqxmdLx/DV2u+5rp D+teQ78BvJUlWg0Zumo7wYQgFHV3RVoVI7q4for12FJo+VewSkCjBU/A21A5sQA9 z9HBKShZZCCNQoy7p4KKoI6NOAOK9+EZUSCrf/KpsmU3ujHt1Nj5W9ia49Xor1gC 4Gd9QBsg+M1MF7oPM69vjYJnwq6TWLK47bHPGd+B9FD1N8FBLUs1A6dzdXnE5gsa XWsRianozQGBriZv9HuE7IidhZYYPQuXu6O/pq/w0uQwA9ivKcFi+stayd5MjeCq vQLfgkSbj32vclU0YtUYy3TqLY6WZQQFP89UB1T9HH+KbFwRin+kPzRBZ+9pPmnN P2NRCUMISdRqbItBaa9Jf5NQ2at+WXsZm/+STKlWhmSqyO2CEJY= =Knre -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org