There are many articles about Apache fastcgi module installation instructions on the Internet, most of them are based on the Apache source code compiled, if it is installed by Yum install httpd, directly according to gourd painting Scoop will encounter a variety of compilation problems, By looking at some of the installation documents written by the foreigner about the FastCGI module (mod_fastcgi) of the CentOS Apache, I have roughly re-organized it.
1. Install compilation-dependent packages
# yum Install httpd-devel Apr apr-devel libtool
2. Download mod_fastcgi Source code
# wget http://www.fastcgi.com/dist/mod_fastcgi-current.tar.gz
3. Unzip and compile the installation
# tar ZXVF mod_fastcgi-2.4.6.tar.gz
# CD mod_fastcgi-2.4.6
# CP Makefile.ap2 Makefile
# Vim Makefile
Modify the Top_dir directory, the path of the 64-bit system to the lib64,32-bit system is/USR/LIB/HTTPD
Top_dir =/usr/lib64/httpd |
After you save the exit, start the compilation installation.
# make
# make Install
4. Loading the module
# vim/etc/httpd/conf/httpd.conf
Find the LoadModule section, add a line of load statements
...
LoadModule Fastcgi_module modules/mod_fastcgi.so ... |
5. Restart the service
#/etc/init.d/httpd Restart
If it starts normally, the following information will be displayed in log
# grep-i "FastCGI"/var/log/httpd/error_log
[Mon Jul 29 06:54:27 2013] [Notice] Fastcgi:process Manager initialized (PID 2098)
[Mon Jul 29 06:54:27 2013] [Notice] apache/2.2.15 (Unix) DAV/2 mod_fastcgi/2.4.6 configured--Resuming normal operations
6. Installing FPM (fastcgi process Manager)
The FPM (FastCGI process Manager) replaces most of the additional features of PHP FastCGI and is useful for high-payload sites.
# yum Install php-fpm
#/ETC/INIT.D/PHP-FPM Start
# Chkconfig PHP-FPM on
# NETSTAT-ANP |grep php
TCP 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 2575/php-fpm
UNIX 3 [] STREAM CONNECTED 25812 2575/php-fpm
UNIX 3 [] STREAM CONNECTED 25811 2575/php-fpm
7. Modify the configuration
Create a new configuration file/etc/httpd/conf.d/fastcgi.php.conf
DirectoryIndex index.html index.shtml index.cgi index.php AddHandler php5-fcgi. php Action php5-fcgi/php5-fcgi alias/php5-fcgi/var/www/cgi-bin/php5-fcgi Fastcgiexternalserver/var/www/cgi-bin/php5-fcgi-idle-timeout 60-host 127.0.0.1:9000-pass-header Authorization |
Restart Apache and FPM:
# Service httpd Restart
# Service PHP-FPM Restart
Test the Phpinfo () page, and the configuration is displayed as:
...
Server API fpm/fastcgi
...
CentOS Install Apache fastcgi Module (mod_fastcgi)