安装Apache2.4:
首先从 http://httpd.apache.org/download.cgi#apache24
下载apache源码包httpd-2.4.4.tar.gz
从 http://apr.apache.org/download.cgi 下载
apr-1.4.6.tar.gz和apr-util-1.5.1.tar.gz
从 http://sourceforge.net/projects/pcre/files/pcre/8.32/ 下载
pcre-8.32.tar.gz
打开终端切到root
su
输入密码
先装gcc和make
yum -y install gcc
yum -y install make
yum -y install gcc-c++ 没有这个gcc-c++一会编译不prce
切到下载好的源码包目录,本人是~/Download
安装apr:
tar -zvxf apr-1.4.6.tar.gz
cd apr-1.4.6
./configure --prefix=/usr/local/apr
make && make install
安装apr-util
tar -zvxf apr-util-1.5.1.tar.gz
cd apr-util-1.5.1
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install
安装pcre
tar -zvxf pcre-8.32.tar.gz
cd pcre-8.32
./configure
make && make install
安装apache 一定要先装上面那三个不然编译不了
tar -zvxf httpd-2.4.4.tar.gz
cd httpd-2.4.4
./configure --prefix=/usr/local/apache --with-apr-util=/usr/local/apr-util
make && make install
启动apache
/usr/local/apache/bin/httpd
安装PHP5.5
yum -y install libxml2-devel 不装这个编译不了PHP5.5
从www.php.net下载PHP5.5
本人下载的是php-5.5.0.tar.gz
切到下载目录
tar -zvxf php-5.5.0.tar.gz
cd php-5.5.0
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --enable-sysvsem --enable-sockets --enable-pcntl --enable-mbstring --enable-mysqlnd --enable-opcache --enable-shmop --enable-zip --enable-ftp --enable-gd-native-ttf --enable-wddx --enable-soap
make && make install
拷贝一份正式的php-fpm.conf
更多选项... ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --enable-sysvsem --enable-sockets --enable-pcntl --enable-mbstring --enable-mysqlnd --enable-opcache --enable-shmop --enable-zip --with-mcrypt=/usr/local/libmcrypt/ --with-zlib=/usr/local/zlib/ --with-curl=/usr/local/curl/ --with-pcre-dir=/usr/local/pcre/ --with-t1lib=/usr/local/tlib/ --with-pdo-mysql=/usr/ --with-fpm-user=www --with-fpm-group=www
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
启动PHP:
/usr/local/php/sbin/php-fpm
编辑apache配置文件:
vim /usr/local/apache/conf/http.conf
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_
fcgi
_module modules/mod_proxy_fcgi.so
把这两行前面的#号去掉
在最下面加两行:
ServerName 127.0.0.1
ProxyPassMatch ^/(.*.php)$ fcgi://127.0.0.1:9000/usr/local/apache/htdocs/$1
保存退出:wq
重启Apache
/usr/local/apache/bin/apachectl restart
OK了,写个phpinfo看效果吧