How to install apache 2.4 and how to enable FastCGI?
In this documentation, we can discuss about how to install apache 2.4 and enable fastcgi. To perform this, please follow the below given steps.
Apache
1) First you need to install Dependencies before installing apache and fastcgi.
$ yum install gcc -y
2) Download tar file of apache2.4
$ wget http://apache.techartifact.com/mirror/httpd/httpd-2.2.22.tar.bz2
3) Extract the tar file.
$ tar -xvf httpd-2.2.22.tar.bz2
4) Configure and install apache 2.4
$ cd httpd-2.2.22
$ ./configure –prefix=/usr/local/apache2.4 –enable-so –enable-mods-shared=”most” –enable-suexec \ –with-suexec-caller=”nobody”
$ make
$ make install
5) Restart the newly installed apache.
$ pkill httpd
$ /usr/local/apache2.4/bin/apachectl restart
6) Now you need to check the port is opened.
$ netstat -ntlp | grep :80
The output will be look like the following:
tcp 0 0 :::80 :::* LISTEN 31097/httpd
7) You can check the newly installed apache is working properly by doing the following steps.
Open your browser and access http://127.0.0.1 or http://your IP, then you will get a test page.
PHP
1) Install necessary dependencies.
$ yum install libxml2-devel -y
2) Download the PHP source file.
$ wget http://in3.php.net/get/php-5.4.8.tar.gz/from/this/mirror
3) Extract the tar file.
$ tar -xvf php-5.4.8.tar.gz
4) Configure and install the php file.
$ cd php-5.4.8
$ ./configure –prefix=/usr/local/php5.4
$ make
$ make install
$ cp /php-5.4.8/php.ini-production /usr/local/php/lib/php.ini
Mod FastCGI
1). Download fastcgi tar file.
$ wget http://apache.techartifact.com/mirror/httpd/mod_fcgid/mod_fcgid-2.3.6.tar.gz
2) Extract the tar file.
$ tar -xvf mod_fcgid-2.3.6.tar.gz
3) Configure and install the fastcgi file.
$ cd mod_fcgid-2.3.6
$ export APXS=/usr/local/apache2.4/bin/apxs
$ ./configure.apxs
$ make
$ make install
Let’s check whether the module has been loaded or not?
Create a PHP info page in the apache home directory using the following command.
$ touch info.php
Open the info.php file using your favorite text editor and add the following code into the file. Here I am using the ‘vi’ text editor.
$ vi info.php
<?php
phpinfo ();
?>
Then access http://yourIp/info.php
Important configuration files
Apache configuration file:
/usr/local/apche2.4/conf/httpd.conf
Apache home directory:
/usr/local/apache2.4/httpddocs