Tuesday 11 December 2018

How to configure Apache MPM.

                   Apache uses one of following MPM(Multi-Processing Module) for handling incoming requests and processes them. It modifies basic functionality of the Apache server related to multi-thread and multi-processes style of working. Only one MPM can be loaded into the server at any time.

Types of MPM’s :-
  1. Prefork MPM
  2. Worker MPM
  3. Event MPM

Command to check MPM:   httpd  –V      

Number of connection calculation as per core  CPU.

The MaxClients is optimal at 200 * the count of CPU cores for the prefork mpm  &
 300 * the count of CPU cores for the workermpm.

Below is the snapshot of "httpd-mpm.conf" file.

 <IfModule mpm_worker_module>
                ThreadLimit                       30
                ServerLimit                        10
                StartServers                       3
                MinSpareThreads             5
                MaxSpareThreads            20
                MaxClients                          300
                ThreadsPerChild               30
                MaxRequestsPerChild     0

Let’s understand the above MPM_worker _module configuration.

1.    Server will going to start with “3” child processes ( i.e StartServers = 3)
Which is called as number of child processes during start.

2.    Where each child processes will start handling “30” threads/Requests.
 (i.e ThreadsPerChild = 30)

3.     So total number of concurrent connection/clients = “90”
      (i.e StartServers * ThreadsPerChild  = concurrent connection/clients at start [3*30= 90])

Total = 90 concurrent connection/clients

4.     If more concurrent users where to come then another child process will go to start/add.

5.    As already “3” child processes where consumed/busy , so another child processes where going to start as per “ServerLimit”   ( i.e we have ServerLimit  =  10).

6.    So total number of  max Connections/clients can be serve = 300
( i.e ServerLimit * ThreadsPerChild , 10*30 = 300 MaxClients  )

7.    A “ServerLimit” can be calculated,   As  ServerLimit =  MaxClients  / ThreadsPerChild
 (i.e ServerLimit= 300/30)

8.     A “ThreadLimit”   where stands for Number of threads on per child processes.

9.     MinSpareThreads” where stands for minimum number of worker threads which are kept spare, Sets the desired minimum number of idle [free] child server processes)

10.   If  MaxRequestsPerChild / MaxConnectionsPerChild is 0, then the process will never expire.

The recommended value of maxThreads & MaxClients is 200 per CPU, so here we assume the server is a single core machine. 
If it had been quad core, we could push that value to 800 or more depending on RAM and other machine specs. 
The total threads is an aggregate value. If Apache and JBoss are on the same server, and that server has four cores, then you would halve the maxThreads and MaxClients to 400 each.
 Always ensure the total threads possible doesn't exceed 200 times the number of CPU cores.

Reference links: 

Thanks :-)

Wednesday 28 November 2018

What is Nginx & How to install on RHEL

NGINX is an open-source web server used by more than 409 million websites and over 63% of the world’s top 10,000 websites.

NGINX Inc. is the company that created that software, and they sell NGINX Plus and more software products to IT professionals in companies all over the globe.

   Similarities between Nginx & Apache:

   1. Free and open source software.
   2. Community for the users, reviewing code.
   3. Can be Added functionality through dynamic modules.
   4. Reverse Proxy servers can be done.
   5. Event-based processing for the large number simultaneous connections.

   Differences between Nginx & Apache:

   Why Nginx?
  • .       Market-leading web server.
  • .       It’s too efficient & easy to enable 3rd party modules.
  • .       It's consistent in performance under heavy load.
  • .       Needed fewer hardware resources to serve the requests.
  • .       Easy to install and configure.
  • .       Upgrade on running instance, no downtime needed during the up-gradation of Nginx.
  • .       Scalable in the concurrent connection handling.
  • .     NGINX is one of a handful of servers written to address the C10K problem.

   Installation on RHEL 7
         Two methods to install Nginx on the server :
1.       Using Pre-compiled binaries.
2.       Compile using a Source-file.

 Method 1:   Using Pre-compiled binaries.

  I am installing Nginx on "google-cloud"  RHEL 7 server.

 Step 1: Prepare the build environment.
To ensure your build environment has these prerequisites installed, run the appropriate command.
Command :  yum  install  -y  gcc  gcc-c++   make   pcre-devel   zlib-devel   expat-devel   mailcap   openssl*  

 Step 2: Install Nginx using the below command.

       Command: yum  install  nginx

 Step 3: Create a service of nginx using below command.

Command : chkconfig  nginx  on 

 Step 4: Start the nginx through command.

Command:  systemctl   start   nginx

 Step 5: Check the Nginx version.

Command: nginx  -V

 Step 6: Check through the browser, use your IP address.

 Step 7:  "Nginx" directories and its descriptions.


Config dir.
Master/Global config file.
Document root directory
Extra configuration files.
log location folder (access.log & error.log).
Main nginx file location.

 Step 8:  "Nginx" useful commands and its descriptions.

nginx -s  [signal]
Signal (Where signal may be one of the following).
nginx -s  stop
Fast Shutdown.
nginx -s quit
Graceful shutdown (to stop nginx processes with waiting for
the worker processes to finish serving current requests).
nginx -s reload
Reloading the configuration file (Changes made in the configuration file will not be applied until the command to reload configuration is sent to Nginx or it is restarted).
nginx  -s reopen
Reopening the log files.
nginx   -t
To test the configuration file (nginx.conf).
nginx   -T
To test configuration, dump it and exit.
nginx  -V
Show version and configure options then exit.
nginx  -v
Show version and exit.
nginx  -h
This is print help.
nginx  -c  filename
Specify which configuration file NGINX should use instead of the default.
nginx  -T | less
To test configuration, dump it &  page wise view.

Nginx-Docs link:

Reference links :

Thanks, folks :-)

Monday 5 November 2018

Install LAMP on SUSE Linux with Real time application example.

LAMP is generally stands for “Linux, Apache, MySQL (Maria-DB), and PHP

LAMP is an open source Web development platform that uses Linux as the operating system,
Apache as the Web server, MySQL as the relational database management system and PHP as the object-oriented scripting language.

Step 1: Install a UNIX/Linux server.
             I am using SUSE Linux operating system.

Step 2: Install Apache server.

Command:#   zypper  install httpd

Step 3: Create a symlinks to start & stop the apache through services.

Command:#    systemctl enable apache2

Step 4:  Start the Apache services.

Command:#   systemctl  start apache2

Step 5: Check the repos of suse linux.

Command:# zypper repos

Step 6: refresh the repos.

Command:#   zypper refresh

Step 7: Install "php"  libraries.

Command:#   zypper in php5*

Step 8: Check information pattern of lamp server.

Command:#   zypper info -t pattern lamp_server

Step 9: Install lamp server pattern. & press y to view the notification for Database.

Command:#   zypper in -t pattern lamp_server

Step 10: Start the mysql database.

Command:#   rcmysql start

Step 11: Check the status for mysql database.

Command:#   rcmysql status

Command:#   chkconfig  -a mysql

Step 12: Set a password for root user in database.

Command:#    '/usr/bin/mysqladmin'    -u root   password 'suse'

 You also change the database password through below command.

 Command: #    '/usr/bin/mysql_secure_installation'

Step 13: Create a new php page on apache.

Command:#   vi /srv/www/htdocs/info.php


Also, un-comment the 873 line on below located  php.ini file

 Command:#   vi   /etc/php5/apache2/php.ini

872 ;extension=php_ldap.dll
873  extension=php_mbstring.dll
874 ;extension=php_exif.dll

Step 14: enable php5 module to use in apache configuration.

Command:#   a2enmod  php5

Step 15: Restart the apache2 service & Check the apache url.

Command:#    systemctl restart apache2.service

Step 16: Give full permission to php5 libraries.

Command:#   chmod -R  777  /var/lib/php5/

Command:#    systemctl restart apache2

Step 17: Now,  We have to install phpMyAdmin & pwgen repos lib files.

Use below link to download:

Step 18: Install both the rpm pwgen & phpMyAdmin libraries.

Command:#   rpm  -ivh  pwgen-2.07-3.1.x86_64.rpm
Command:#   rpm -ivh   phpMyAdmin-4.8.3-29.1.noarch.rpm

Command:#   systemctl restart apache2

Step 19: Using Opensource "osticket" application , a real time example.

Download link:#

Unzip the  & move the upload folder to Apache "/srv/www/htdocs/"

& rename as osticket

Step 20 : Now, you have  successfully installed  osTicket on LAMP.

Thanks :-)

Wednesday 26 September 2018

Apache Mod Cluster as load balancer (LB) - JBoss 6.4

Supports Sticky Sessions
Adapts to Deployment Status
Yes. Detects deployment and undeployment of applications and dynamically decides whether to direct client requests to a server based on whether the application is deployed on that server.
No. Directs client requests to the container as long as the container is available, regardless of application status.
No. Directs client requests to the container as long as the container is available, regardless of application status.
No. Directs client requests to the container as long as the container is available, regardless of application status.
No. Directs client requests to the container as long as the container is available, regardless of application status.

  • ·         Workers register themselves with httpd servers.
  • ·         NO more
  • ·         Changes in cluster topology are send to httpd.
  • ·         Deployed applications are automatically register, which can be Disable, stop & Enable    from balancer HTTP console.
  • ·         NO 404s for un-deployed applications.
  • ·         Load balancer function automatically managed.

Software Details:

Step 1: Install Apache server on UNIX.

Use below link to install Apache server on UNIX step by step.

Step 2: Download “mod_cluster modules for httpd” from below link, as per your environment.



Step 3: Move this mod_cluster modules to installed Apache server modules location.  “$Apache_Home/modules”.

Step 4: Add below configuration to httpd.conf file at “$Apache_Home/conf”.

NOTE: Disable mod_proxy_balancer module.
# mod_proxy_balancer should be disabled while using mod_cluster.

LoadModule proxy_module modules/
LoadModule proxy_ajp_module modules/
LoadModule proxy_cluster_module modules/
LoadModule cluster_slotmem_module modules/
LoadModule manager_module modules/
LoadModule advertise_module modules/

MemManagerFile /Apache/HTTPDWEB2.4/MemManagerFile

<IfModule manager_module>
        ManagerBalancerName mycluster-1
        ManagerBalancerName mycluster-2

    <Directory />
##      AllowOverride None
      Require all granted
    ServerAdvertise off
        KeepAliveTimeout 60

<Location /mod_cluster_manager>
    SetHandler mod_cluster-manager
      Require all granted


AllowDisplay On

MemManagerFile: That is the base name for the names mod_manager will use to store configuration, generate keys for shared memory or lock files. That must be an absolute path name; the directories will created if needed. It is highly recommended that those files are placed on a local drive and not an NFS share.
Default: $Apache_Home/logs/.

ServerAdvertise On: Use the advertise mechanism to tell the JBoss AS to whom it should send the cluster information.
ServerAdvertise On http://hostname:port: Tell the hostname and port to use. Only needed if the VirtualHost is not defined correctly, if the VirtualHost is a Name-based Virtual Host [http://] or when VirtualHost is not used.
ServerAdvertise Off: Don't use the advertise mechanism.

EnableMCPMReceive - Allow the VirtualHost to receive the MCPM from the nodes. You need one EnableMCPMReceive in your httpd configuration to allow mod_cluster to work, put it in the VirtualHost where you configure advertise.

SetHandler mod_cluster-manager: That is the handler to display the node mod_cluster sees from the cluster. It displays the information about the nodes like INFO and additionally counts the number of active sessions.

On httpd 2.2
Order allow,deny
Allow from all

And On   httpd 2.4 we use,
Require all granted

We have done with mod_cluster configuration on Apache Server.



Step 5:  For performing  mod_cluster method, we need to use standalone-ha.xml or standalone-full-ha.xml profile, Since this ha & full-ha has a mod_cluster subsystem configuration.
We will use ha profile.

Step 6: Add Jboss Server name on “standalone-ha.xml”.
<?xml version='1.0' encoding='UTF-8'?>

<server name="jboss-eap-6.4-1"   xmlns="urn:jboss:domain:1.7">


Step 7: Add Proxy-list and  Balancer name to “standalone-ha.xml” mod cluster subsystem.

        <subsystem xmlns="urn:jboss:domain:modcluster:1.2">
            <mod-cluster-config proxy-list=""  advertise-socket="modcluster" connector="ajp" balancer="mycluster-1" >
                    <load-metric type="busyness"/>

Step 8: Add Node name to “standalone-ha.xml” web subsystem.

     <subsystem xmlns="urn:jboss:domain:web:2.2" default-virtual-server="default-host" native="false" instance-id="jboss-eap-Node-1" >
            <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
            <connector name="ajp" protocol="AJP/1.3" scheme="http" socket-binding="ajp"/>
            <virtual-server name="default-host" enable-welcome-root="true">
                <alias name="localhost"/>
                <alias name=""/>


 Step 9: Start the “JBoss instance-1” from “$JBOSS_HOME-1/bin”, using below script,

./  -c  standalone-ha.xml   -b  -bmanagement


Step 10: Now, perform same configuration changes using different server name, balancer name & instance-id on “JBoss instance-2”.

NOTE:  use port offset for socket-binding on “standalone-ha.xml”.

  <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:10}">

Step 11: Start the “JBoss instance-2” from  “$JBOSS_HOME-2/bin”, using below script.

./  -c  standalone-ha.xml   -b  -bmanagement


Step 12: Check through browser, using http://ip:PORT/mod_cluster_manager


Step 13: check the applications.


Reference links:

Thanks :-)