RE: How to start multiple apache daemon in apache 2.2.8 on RHEL 5.1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

	I'm not sure since what you have seems a bit different then our
setup.  I'll just describe what we have.  The directories in our
ServerRoot are

/etc/APACHE_INSTANCE
	conf
	conf.d
	logs    -> /var/logs/APACHE_INSTANCE
	modules -> /usr/lib/modules
	run     -> /var/run

in the httpd.conf file we have 

#
# PidFile: The file in which the server should record its process
# identification number when it starts.
#
PidFile run/APACHE_INSTANCE.worker.pid

Then when I do a ps -ef | grep APACHE_INSTANCE I see
root     16862     1  0 06:59 ?        00:00:00
/usr/sbin/APACHE_INSTANCE.worker -d /etc/APACHE_INSTANCE
root     16866     1  0 06:59 ?        00:00:00
/usr/sbin/APACHE_INSTANCE.worker -d /etc/APACHE_INSTANCE
root     16867 16866  0 06:59 ?        00:00:00
/usr/sbin/APACHE_INSTANCE.worker -d /etc/APACHE_INSTANCE
apache   16868 16862  0 06:59 ?        00:00:00
/usr/sbin/APACHE_INSTANCE.worker -d /etc/APACHE_INSTANCE
apache   16872 16862  0 06:59 ?        00:00:00
/usr/sbin/APACHE_INSTANCE.worker -d /etc/APACHE_INSTANCE

Not sure if that helps or not.  

~Jet

-----Original Message-----
From: Vinay Purohit [mailto:Vinay.Purohit@xxxxxxxxxx] 
Sent: Tuesday, May 06, 2008 4:23 AM
To: users@xxxxxxxxxxxxxxxx
Subject:  How to start multiple apache daemon in apache
2.2.8 on RHEL 5.1


Hi Jet,
In apache 2.2.8 PidFile directive is not present in httpd.conf file and
hence the following command failed.

sed -e "s/$ORIG_APACHE\.pid/$NEW_APACHE\.worker\.pid/g" \
    -e "s/\/$ORIG_APACHE/\/$NEW_APACHE/g" --in-place
$NEW_CONF/conf/httpd.conf

I tried to change the ServerRoot directive to point to the new server
root. 
1. Install Apache 2.2.8 in /usr/apache1.
2. Copy the Apache1 to usr/Apache2
3. change the httpd.conf of usr/Apache2 to new IP and ServerName also
change the ServerRoot.
4. run ./apachectl -f usr/Apache1/conf/httpd.conf -k start
5. run ./apachectl -f usr/Apache2/conf/httpd.conf -k start It says pid
xyz is already running......... Any idea how to solve it ?

It seems it is using only one pid file for both server root.

\Vinay

 



-----Original Message-----
From: Wilda, Jet [mailto:Jet.Wilda@xxxxxxxxxxxxxxxxxxx]
Sent: Friday, May 02, 2008 11:40 PM
To: users@xxxxxxxxxxxxxxxx
Subject: RE:  RE:How to start apache daemon in apache 2.2.8
on RHEL 5.1

I'm not familiar with the Windows side, however it is effectively
separate daemon processes that can be stopped and started independently.
Remember that you need to over ride the /etc/init.d/functions killproc
if you use symlinks for the binaries (there are pros and cons to this).
Here is the code we use in our /etc/init.d/$NEW_APACHE scripts to make
sure it doesn't kill all the Apache instances running.

# A function to stop a program.
killproc() {
        RC=0; delay=3
        # Test syntax.
        if [ "$#" -eq 0 ]; then
                echo $"Usage: killproc [ -d delay] {program} [signal]"
                return 1
        fi
        if [ "$1" = "-d" ]; then
                delay=$2
                shift 2
        fi

        notset=0
        # check for second arg to be kill level
        if [ -n "$2" ]; then
                killlevel=$2
        else
                notset=1
                killlevel="-9"
        fi

        # Save basename.
        base=${1##*/}

        # Find pid.
        pid=
        if [ -f $pidfile ]; then
                local line p
                read line < $pidfile
                for p in $line ; do
                        [ -z "${p//[0-9]/}" -a -d "/proc/$p" ] &&
pid="$pid $p"
                done
        fi

        # Kill it.
        if [ -n "${pid:-}" ] ; then
                [ "$BOOTUP" = "verbose" -a -z "$LSB" ] && echo -n "$base
"
                if [ "$notset" -eq "1" ] ; then
                       if checkpid $pid 2>&1; then
                           # TERM first, then KILL if not dead
                           kill -TERM $pid >/dev/null 2>&1
                           usleep 100000
                           if checkpid $pid && sleep 1 &&
                              checkpid $pid && sleep $delay &&
                              checkpid $pid ; then
                                kill -KILL $pid >/dev/null 2>&1
                                usleep 100000
                           fi
                        fi
                        checkpid $pid
                        RC=$?
                        NUM=`ps -ef | grep $prog | grep -v "grep" | grep
-v "service" | grep -v "init.d" | wc -l`
                        if [ $NUM -gt 0 ]; then
                                failure $" shutdown"
                                echo
                                ps -ef | grep $prog | grep -v "grep" |
grep -v "service" | grep -v "init.d"
                                echo
                        else
                                [ "$RC" -eq 0 ] && failure $"$base
shutdown" || success $"$base shutdown"
                        fi
                        [ "$RC" -eq 0 ] && failure $"$base shutdown" ||
success $"$base shutdown"
                        RC=$((! $RC))
                # use specified level only
                else
                        if checkpid $pid; then
                                kill $killlevel $pid >/dev/null 2>&1
                                RC=$?
                                [ "$RC" -eq 0 ] && success $"$base
$killlevel" || failure $"$base $killlevel"
                        fi
                fi
        else
            failure $"$base shutdown"
            RC=1
        fi

        # Remove pid file if any.
        if [ "$notset" = "1" ]; then
            rm -f $pidfile
        fi
        return $RC
}

________________________________________
From: Vinay Purohit [mailto:Vinay.Purohit@xxxxxxxxxx]
Sent: Friday, May 02, 2008 1:58 PM
To: users@xxxxxxxxxxxxxxxx; users@xxxxxxxxxxxxxxxx
Subject: RE:  RE:How to start apache daemon in apache 2.2.8
on RHEL 5.1

 
Thanks Jet !! Is it effectively different apache virtual running as a
different daemon which can be started and stoped without affecting
others ? Is it same as running IP based virtual server (apache3.3.8
service/daemon) on windows ?
 
\Vinay

 
________________________________________
From: Wilda, Jet [mailto:Jet.Wilda@xxxxxxxxxxxxxxxxxxx]
Sent: Fri 5/2/2008 11:15 PM
To: users@xxxxxxxxxxxxxxxx
Subject: RE:  RE:How to start apache daemon in apache 2.2.8
on RHEL 5.1 Hi,

        We run multiple Apache httpd instances on Red hat all with
different server roots and here is how we do it  (I hope this is what
your asking,-).  Below are the steps we do to create a new server root
and binary (or symlink of a new binary to the old).  $ORIG_APACHE=httpd
and $NEW_APACHE=whatever_you_want and $BINDIR=/usr/sbin.

OLD_CONF=$ETC/$ORIG_APACHE
NEW_LOG=$APPLOG/$NEW_APACHE
NEW_CONF=$ETC/$NEW_APACHE

# create the new directory for the configuration files mkdir
$ETC/$NEW_APACHE

# create a logging directory
mkdir $NEW_LOG

# OK, now build out the configuration directory ln -s $NEW_LOG
$NEW_CONF/logs ln -s /usr/lib/$ORIG_APACHE/modules $NEW_CONF/modules ln
-s $VAR/run $NEW_CONF/run

# link in a new executable
ln -s $BINDIR/$BINNAME $BINDIR/$NEWBINNAME

# copy in the configuration files
mkdir $NEW_CONF/conf
cp -Rp $OLD_CONF/conf/* $NEW_CONF/conf/

# make modifications to the configuration files sed -e
"s/$ORIG_APACHE\.pid/$NEW_APACHE\.worker\.pid/g" \
    -e "s/\/$ORIG_APACHE/\/$NEW_APACHE/g" --in-place
$NEW_CONF/conf/httpd.conf

# copy in the subordinate configuration files mkdir $NEW_CONF/conf.d cp
-Rp $OLD_CONF/conf.d/* $NEW_CONF/conf.d/

# add 2 lines into /etc/sysconfig/$NEW_APACHE echo
"HTTPD=/usr/sbin/$NEWBINNAME" >> $ETC/sysconfig/$NEW_APACHE echo
"OPTIONS=\"-d $ETC/$NEW_APACHE\"" >> $ETC/sysconfig/$NEW_APACHE

# Copy the rc start script
cp $ETC/init.d/$ORIG_APACHE $ETC/init.d/$NEW_APACHE

#Add the the automatic startup scripts and set to start on boot
chkconfig --add $NEW_APACHE chkconfig $NEW_APACHE on

Then just edit the $ETC/$NEW_APACHE/conf/httpd.conf and/or the
$ETC/$NEW_APACHE/conf.d/ssl.conf and as root 'service $NEW_APACHE
start'.  NOTE this assumes that you are using the default structure that
Red Hat lays it's Apache httpd down as.

One thing to NOTE is that we had to over-ride the killproc function in
'/etc/init.d/functions' because of the way it tries to find the pid of
what is running.  Since we symlink the binarys it would kill all the
running apache instances.

Hope that helps :-)
~Jet

-----Original Message-----
From: Eric Covener [mailto:covener@xxxxxxxxx]
Sent: Friday, May 02, 2008 11:26 AM
To: users@xxxxxxxxxxxxxxxx
Subject: Re:  RE:How to start apache daemon in apache 2.2.8
on RHEL 5.1

On Fri, May 2, 2008 at 10:12 AM, Vinay Purohit
<Vinay.Purohit@xxxxxxxxxx> wrote:
>  Thanks Eric :-)
>
>  Can you please provide little more detail on this. Precisely, I want
to
>  run multiple httpd based on the httpd.conf supplied as start
parameter.

Create a set of init scripts based on the one supplied by redhat, and
modify the invocation of apachectl or httpd within the script to pass
different -f parameters.

--
Eric Covener
covener@xxxxxxxxx

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server
Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
----------
Learn more about Chase Paymentech Solutions,LLC payment processing
services at www.chasepaymentech.com.

THIS MESSAGE IS CONFIDENTIAL.  This e-mail message and any attachments
are proprietary and confidential information intended only for the use
of the recipient(s) named above.  If you are not the intended recipient,
you may not print, distribute, or copy this message or any attachments.
If you have received this communication in error, please notify the
sender by return e-mail and delete this message and any attachments from
your computer.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server
Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
----------
Learn more about Chase Paymentech Solutions,LLC payment processing
services at www.chasepaymentech.com.

THIS MESSAGE IS CONFIDENTIAL.  This e-mail message and any attachments
are proprietary and confidential information intended only for the use
of the recipient(s) named above.  If you are not the intended recipient,
you may not print, distribute, or copy this message or any attachments.
If you have received this communication in error, please notify the
sender by return e-mail and delete this message and any attachments from
your computer.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server
Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server
Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
----------
Learn more about Chase Paymentech Solutions,LLC payment processing services at www.chasepaymentech.com.

THIS MESSAGE IS CONFIDENTIAL.  This e-mail message and any attachments are proprietary and confidential information intended only for the use of the recipient(s) named above.  If you are not the intended recipient, you may not print, distribute, or copy this message or any attachments.  If you have received this communication in error, please notify the sender by return e-mail and delete this message and any attachments from your computer.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux