CentOS YUM安裝Apache2後如何安裝配置mod_fastcgi

由於php php-fpm是編譯安裝的,httpd是yum安裝的

安裝fastcgi時發現 yum search mod_fastcgi 沒有。那麼只有編譯安裝mod_fastcgi了

cd /usr/local/vipcloud/src/
wget http://www.fastcgi.com/dist/mod_fastcgi-current.tar.gz
tar -zxvf mod_fastcgi-current.tar.gz
cd mod_fastcgi-2.4.6
more README

然後發現需要看INSTALL.AP2

繼續


more INSTALL.AP2

看到

*NIX
  ====
    $ cd <mod_fastcgi_dir>
    $ cp Makefile.AP2 Makefile
    $ make
    $ make install
    If your Apache2 installation isn't in /usr/local/apache2, then
    set the top_dir variable when running make (or edit the
    Makefile), e.g.
      $ make top_dir=/opt/httpd/2.0.40
    Add an entry to httpd.conf like this:
      LoadModule fastcgi_module modules/mod_fastcgi.so

看第7行,需要指定apache2的安裝目錄

由於apache是yum安裝的 沒有特定的安裝目錄,浪個辦?想到反正這裏是需要module的目錄吧,於是將

cp Makefile.AP2  Makefile
vim Makfiel
把top_dir=替換爲
top_dir = /usr/lib64/httpd

然後 make && make install

報錯。

看來不能直接這樣。

度娘之。

度娘出來的都是編譯安裝apache的fastcgi安裝

google之

http://www.cyberciti.biz/tips/rhel-centos-fedora-apache2-fastcgi-php-configuration.html


yum install libtool httpd-devel apr-devel apr

然後在make make install安裝 搞定。

 

touch /var/www/cgi-bin/php.fcgi


vim /var/www/cgi-bin/php.fcgi


#!/bin/bash
# Shell Script To Run PHP5 using mod_fastcgi under Apache 2.x
# Tested under Red Hat Enterprise Linux / CentOS 5.x
### Set PATH ###
PHP_CGI=/usr/local/vipcloud/php/bin/php-cgi # php 安裝的路徑
PHP_FCGI_CHILDREN=4
PHP_FCGI_MAX_REQUESTS=1000
### no editing below ###
export PHP_FCGI_CHILDREN
export PHP_FCGI_MAX_REQUESTS
exec $PHP_CGI
cd /etc/httpd/conf.d
vim fsatcgi.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/php.fcgi
FastCgiExternalServer /var/www/cgi-bin/php.fcgi -idle-timeout 60 -host 127.0.0.1:9000 -pass-header Authorization

touch /var/www/html/test.php

echo "<?phpinfo()?>" >test.php




發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章