1. How to add a new site configuration

Go to the directory /etc/apache2/sites-available and you will find there a default configuration file named “default”

Copy this file to a new one and then in order to enable it type: a2ensite <sitename> and this will make a link to the /etc/apache2/sites-enabled

Now your site is accessible from web browser

2. How to enable a module on Apache

In order to enable an apache module you can use the command a2enmod <modulename>. This will copy the module from mods-available to mods-enabled

3. How to enable load balancing with Apache Web Server and Tomcat

Tomcat Config: First you have to modify server.xml in each tomcat to name the node of the cluster. This can be done in the following line
<EngineName=”Catalina” defaultHost=”localhost” jvmRoute=”node1″>

Apache Config: Enable mod_proxy.sp, mod_proxy_ajp.so, mod_proxy_balancer.so
Modify your site configuration to route the requests to seperate jvm’s

<Proxy balancer://mycluster stickysession=JSESSIONID>
BalancerMember ajp://127.0.0.1:8009 route=node1
BalancerMember ajp://127.0.0.1:8019 route=node2
</Proxy>

ProxyPass /examples balancer://mycluster/examples

Enable Load Balancer Manager

Modify your apache configuration site file and add the following lines

<Location /balancer-manager>
SetHandler balancer-manager
</Location>

Now you can see your balancer in the url http://localhost:port/balancer-manager

 

By admin