LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Upgrading Apache 2.2 to 2.4 on CentOS 6.x (https://www.linuxquestions.org/questions/linux-server-73/upgrading-apache-2-2-to-2-4-on-centos-6-x-4175627304/)

vasim38 04-09-2018 08:49 AM

Upgrading Apache 2.2 to 2.4 on CentOS 6.x
 
-sh-4.1$ /usr/local/apache2/bin/apachectl -v
Server version: Apache/2.4.20 (Unix)
Server built: Apr 9 2018 13:16:08

-sh-4.1$ httpd -v
Server version: Apache/2.2.15 (Unix)
Server built: Aug 15 2017 19:44:58

-sh-4.1$ cat /etc/redhat-release
CentOS release 6.9 (Final)


All - As above mentioned details, CentOs 6.x doesn't support Http v2.4 and it needs to be installed through Apr/Apr-Util packages. I have both the http versions running. I would like to know how to make my existing application to use new version of apache ? If i stop older http version (2.2) , "httpd -v" command won't work but i need to use "apachectl -v". Kindly advise.

bathory 04-09-2018 10:40 AM

Hi and welcome to LQ,

Quote:

/usr/local/apache2/bin/apachectl -v
Server version: Apache/2.4.20 (Unix)
Server built: Apr 9 2018 13:16:08

-sh-4.1$ httpd -v
Server version: Apache/2.2.15 (Unix)
Server built: Aug 15 2017 19:44:58
If you have installed apache under /usr/local/apache2, and you want to use that instead of the one that came with your distro, you need to disable the latter from starting on boot.
For this run, as root:
Code:

chkconfig httpd off
Then you can add in /etc/rc.local the following:
Code:

/usr/local/apache2/bin/apachectl start
If you want to be more productive, you can edit the original /etc/init.d/httpd startup script and add your apache installation as the httpd service, instead of the original httpd.


Regards

vasim38 04-09-2018 10:49 AM

"If you want to be more productive, you can edit the original /etc/init.d/httpd startup script and add your apache installation as the httpd service, instead of the original httpd. "

Hi Bathory - Would you let me know in detail on above ?

I want to print version 2.4 on httpd command.

vasim38 04-09-2018 10:52 AM

apachectl=/usr/sbin/apachectl
httpd=${HTTPD-/usr/sbin/httpd}
prog=httpd


Above are the line in /etc/init.d/httpd script. If i change as below, will it work ?

apachectl=/usr/sbin/apachectl
httpd=$apachectl
prog=httpd

bathory 04-09-2018 11:21 AM

Quote:

Originally Posted by vasim38 (Post 5841084)
"If you want to be more productive, you can edit the original /etc/init.d/httpd startup script and add your apache installation as the httpd service, instead of the original httpd. "

Hi Bathory - Would you let me know in detail on above ?

I want to print version 2.4 on httpd command.

If you want to print the 2.4.x version, you need to add the path to the httpd executable before anything else in your PATH env. variable. For the bash shell, run:
Code:

export PATH=/usr/local/apache2/bin:$PATH
To make this permanent, see this



Quote:

Originally Posted by vasim38 (Post 5841085)
apachectl=/usr/sbin/apachectl
httpd=${HTTPD-/usr/sbin/httpd}
prog=httpd


Above are the line in /etc/init.d/httpd script. If i change as below, will it work ?

apachectl=/usr/sbin/apachectl
httpd=$apachectl
prog=httpd

This is the httpd service startup script. If you want to use it, you need to edit it (make a backup first) and change the location of the various files mentioned there accordingly.

vasim38 04-09-2018 12:16 PM

Awesome Bathory !

It worked

-sh-4.1$ httpd -v
Server version: Apache/2.4.20 (Unix)
Server built: Apr 9 2018 13:16:08

bathory 04-10-2018 12:42 AM

Quote:

Originally Posted by vasim38 (Post 5841106)
Awesome Bathory !

It worked

-sh-4.1$ httpd -v
Server version: Apache/2.4.20 (Unix)
Server built: Apr 9 2018 13:16:08

Cool.!
Now that it worked, consider updating it to the latest version (2.4.33) for security reasons.

Regards


All times are GMT -5. The time now is 11:54 PM.