Wednesday 18 January 2017

Multiple Apache 2 instances configuration in Centos7

Multiple Apache 2 instances  configuration in Centos7::
===============================================

Multiple apache instances run on the same server  under different user accounts and ports

Here for example we can install apache  for the user 'linuxgeek1'  with common group 'apache'.

For more instances add more users and repeat the same steps below:

# yum install gcc

Creating the users and group::
groupadd apache
useradd -g apache -m -d /home/linuxgeek1 linuxgeek1
useradd -g apache -m -d /home/linuxgeek2 linuxgeek2

Installing apache  for first user:

Login as  linuxgeek1
# su - linuxgeek1

Download Apache latest version, under home directory  /home/linuxgeek1

# wget  http://redrockdigimark.com/apachemirror//httpd/httpd-2.4.25.tar.gz
# tar -zxvf   httpd-2.4.25.tar.gz

untar the source file as  /home/linuxgeek1/httpd-2.4.25

The dependencies  during the installation are as follows::

Download the dependencies under /home/linuxgeek1/httpd-2.4.25/srclib/ and untar it  there before apache compilation

It will appear as
 /home/linuxgeek1/httpd-2.4.25/srclib/  # ll

 drwxr-xr-x. 28  linuxgeek1 apache 4096 Jan 18 14:00 apr
drwxr-xr-x.  20  linuxgeek1 apache 4096 Jan 18 14:00 apr-util
-rw-r--r--.      1   linuxgeek1 apache 357 Jan 18 14:00 Makefile
-rw-r--r--.      1   linuxgeek1 apache   121 Feb 11  2005 Makefile.in
drwxr-xr-x.   9   linuxgeek1 apache 8192 Jan 18 09:39 pcre

 ================
apr-devel
# ./configure --prefix=/home/linuxgeek1/httpd-2.4.25/srclib/apr/

apr-util-devel
#  ./configure --with-apr=/home/linuxgeek1/httpd-2.4.25/srclib/apr/

pcre-8.4.0

=================

Now go to /home/linuxgeek1/httpd-2.4.25


# ./configure --prefix=/home/linuxgeek1/httpd/ --enable-ssl --enable-so --with-included-apr=/home/linuxgeek1/httpd-2.4.25/srclib/apr/ --with-included-apr-util=/home/linuxgeek1/httpd-2.4.25/srclib/apr-util/ --with-pcre=/home/linuxgeek1/httpd-2.4.25/srclib/pcre/pcre-config   --with-mod_jk --enable-mpms-shared=all

# make
# make install

Once installation is done edit httpd.conf  to change the apache port.

change it as follows::
Listen 192.168.1.1:8010

Restart apache

Try it from browser as  http://192.168.1.1:8010

Repeat the same steps for different users using different ports.

No comments:

Post a Comment