I am assuming you know where site-enabled and other folders are
enable modules and configuration following below
/etc/init.d/apache2 stop
sudo a2ensite mynewsite
sudo /etc/init.d/apache2 restart
a2dissite utility to disable sites
Go to /etc/apache2
0.
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod proxy_ajp
1. Modify the config file from sites-enabled folder >nano 000-default and add the below configuration change the documentRoot to the location where you have unzipped the Tomcat I unzipped under /home/localadmin
NameVirtualHost *:80
<VirtualHost *:80>
ServerName ubuntu
DocumentRoot /home/localadmin/
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /balancer-manager !
ProxyPass / balancer://mycluster/ stickysession=JSESSIONID nofailover=On
ProxyPassReverse / http://localhost:8081/ ----three tomcat instance will be running on different ports change server.xml of tomcat to make that work also change the below ajp port in server.xml
ProxyPassReverse / http://localhost:8082/
ProxyPassReverse / http://localhost:8083/
<Proxy balancer://mycluster>
# BalancerMember http://localhost:8081 route=a1
# BalancerMember http://localhost:8082 route=a
BalancerMember ajp://localhost:8109 route=a1
BalancerMember ajp://localhost:8209 route=a2
BalancerMember ajp://localhost:8309 route=a3
ProxySet lbmethod=byrequests
</Proxy>
<Location /balancer-manager>
SetHandler balancer-manager
Order deny,allow
Allow from all
</Location>
</VirtualHost>
2. Enable proxy in proxy.conf in mods-enabled folder
<IfModule mod_proxy.c>
#turning ProxyRequests on and allowing proxying from all may allow
#spammers to use your proxy to send email.
ProxyRequests Off
<Proxy *>
AddDefaultCharset off
Order deny,allow
Deny from none
#Allow from .example.com
</Proxy>
# Enable/disable the handling of HTTP/1.1 "Via:" headers.
# ("Full" adds the server version; "Block" removes all outgoing Via: he$
# Set to one of: Off | On | Full | Block
ProxyVia On
</IfModule>
From terminal find your >servername this will return your server name
Tip: Restart apache and try the link below
using http://yourservername/balancer-manager
enable modules and configuration following below
/etc/init.d/apache2 stop
sudo a2ensite mynewsite
sudo /etc/init.d/apache2 restart
a2dissite utility to disable sites
Go to /etc/apache2
0.
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod proxy_ajp
1. Modify the config file from sites-enabled folder >nano 000-default and add the below configuration change the documentRoot to the location where you have unzipped the Tomcat I unzipped under /home/localadmin
NameVirtualHost *:80
<VirtualHost *:80>
ServerName ubuntu
DocumentRoot /home/localadmin/
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /balancer-manager !
ProxyPass / balancer://mycluster/ stickysession=JSESSIONID nofailover=On
ProxyPassReverse / http://localhost:8081/ ----three tomcat instance will be running on different ports change server.xml of tomcat to make that work also change the below ajp port in server.xml
ProxyPassReverse / http://localhost:8082/
ProxyPassReverse / http://localhost:8083/
<Proxy balancer://mycluster>
# BalancerMember http://localhost:8081 route=a1
# BalancerMember http://localhost:8082 route=a
BalancerMember ajp://localhost:8109 route=a1
BalancerMember ajp://localhost:8209 route=a2
BalancerMember ajp://localhost:8309 route=a3
ProxySet lbmethod=byrequests
</Proxy>
<Location /balancer-manager>
SetHandler balancer-manager
Order deny,allow
Allow from all
</Location>
</VirtualHost>
2. Enable proxy in proxy.conf in mods-enabled folder
<IfModule mod_proxy.c>
#turning ProxyRequests on and allowing proxying from all may allow
#spammers to use your proxy to send email.
ProxyRequests Off
<Proxy *>
AddDefaultCharset off
Order deny,allow
Deny from none
#Allow from .example.com
</Proxy>
# Enable/disable the handling of HTTP/1.1 "Via:" headers.
# ("Full" adds the server version; "Block" removes all outgoing Via: he$
# Set to one of: Off | On | Full | Block
ProxyVia On
</IfModule>
From terminal find your >servername this will return your server name
Tip: Restart apache and try the link below
using http://yourservername/balancer-manager
No comments:
Post a Comment