Knowledgebase

Install Apache 2.4 and suPHP 0.7.2 in CWP

In this tutorial we will show you how easily you can upgrade Apache 2.2 to 2.4 and suPHP 0.7.1 to 0.7.2 in CentOS Web Panel
 

Lets go head with the installation:
 

1) Make directory for files

rm -rf /tmp/apache-build
mkdir -p /tmp/apache-build
cd /tmp/apache-build

 

2) Download Apache 2.4.17 , Apr 1.5.2, Apr-Util 1.5.4 and suPHP 0.7.2.

http://www.eu.apache.org/dist//httpd/httpd-2.4.17.tar.gz
http://www.eu.apache.org/dist//apr/apr-1.5.2.tar.gz
http://www.eu.apache.org/dist//apr/apr-util-1.5.4.tar.gz
http://www.suphp.org/download/suphp-0.7.2.tar.gz

 

3) Extract each compressed folders one by one.

tar zxvf httpd-2.4.17.tar.gz
tar zxvf apr-1.5.2.tar.gz
tar zxvf apr-util-1.5.4.tar.gz
tar zxvf suphp-0.7.2.tar.gz

 

4) Install and configure Apr 1.5.2.

cd /tmp/apache-build/apr-1.5.2
./configure
make
make install

 

5) Install and configure Apr-Util 1.5.4.

cd /tmp/apache-build/apr-util-1.5.4
./configure --with-apr=/usr/local/apr/
make
make install

 

6) Install Apache 2.4.x

cd /tmp/apache-build/httpd-2.4.17
rm -rf /usr/local/apache/conf/httpd.conf
./configure --enable-so --prefix=/usr/local/apache --enable-ssl --enable-unique-id --enable-ssl=/usr/include/openssl --enable-rewrite  --enable-deflate --enable-suexec --with-suexec-docroot="/home" --with-suexec-caller="nobody" --with-suexec-logfile="/usr/local/apache/logs/suexec_log" --enable-asis --enable-filter --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr --enable-headers --enable-expires --enable-proxy
make
make install

 

7) Include related files and folders.

echo "Include /usr/local/apache/conf/sharedip.conf" >> /usr/local/apache/conf/httpd.conf
echo "Include /usr/local/apache/conf.d/*.conf" >> /usr/local/apache/conf/httpd.conf 
echo "ExtendedStatus On" >> /usr/local/apache/conf/httpd.conf
sed -i "s|DirectoryIndex index.html|DirectoryIndex index.php index.html|g" /usr/local/apache/conf/httpd.conf

 

8) Edit /usr/local/apache/conf/httpd.conf and at the end of file add the lines below:

nano /usr/local/apache/conf/httpd.conf

<Directory "/usr/local/apache/htdocs">
        suPHP_UserGroup nobody nobody
</Directory>

 

9) Install suPHP 0.7.2.

cd /tmp/apache-build/suphp-0.7.2
yum install autoconf automake libtool -y
perl -pi -e 's/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/' configure.ac
aclocal
libtoolize --force
automake --add-missing
autoreconf
perl -pi -e 's#"\$major_version" = "2.2"#"\$major_version" = "2.4"#' ./configure
./configure --with-apr=/usr/local/apr/ --with-apxs=/usr/local/apache/bin/apxs --with-setid-mode=paranoid --with-apache-user=nobody --with-gnu-ld --disable-checkpath
make
make install

 

10) Enable related dependencies.

sed -i "s|User daemon|User nobody|g" /usr/local/apache/conf/httpd.conf
sed -i "s|Group daemon|Group nobody|g" /usr/local/apache/conf/httpd.conf
sed -i "s|.*modules/libphp5.so.*||g" /usr/local/apache/conf/httpd.conf
sed -i "s|.*httpd-userdir.conf.*|Include conf/extra/httpd-userdir.conf|" /usr/local/apache/conf/httpd.conf

 

11) Edit /usr/local/apache/conf/httpd.conf and uncomment mod_userdir, mod_rewrite and mod_slotmem_shm.

nano /usr/local/apache/conf/httpd.conf

#LoadModule userdir_module modules/mod_userdir.so
#LoadModule rewrite_module modules/mod_rewrite.so
#LoadModule slotmem_shm_module modules/mod_slotmem_shm.so

 

12) Start Apache.

ln -s /usr/local/apache/bin/httpd /usr/sbin/httpd
service httpd restart

 

13) Configure Apache to auto start on boot.

chkconfig httpd on

 

14) Check apache version and modules loaded.

httpd -M
httpd -v

 

NOTE: Your website will show forbidden error. So you need to add a line Require all granted under each domain in /usr/local/apache/conf.d/vhosts.conf

nano /usr/local/apache/conf.d/vhosts.conf

Look for a lines below:

<Directory "/home/USER/public_html">
        AllowOverride All
</Directory>

Add Require all granted:

<Directory "/home/USER/public_html">
        AllowOverride All
	Require all granted
</Directory>

  • 7 Users Found This Useful
Was this answer helpful?