1. 程式人生 > >實驗:CentOS6編譯LAMP基於FPM模式的應用wordpress

實驗:CentOS6編譯LAMP基於FPM模式的應用wordpress

linux

實驗:CentOS6編譯LAMP基於FPM模式的應用wordpress


軟件版本

ls /root/src

apr-1.6.2.tar.gz

apr-util-1.6.0.tar.gz

httpd-2.4.28.tar.bz2

mariadb-5.5.57-linux-x86_64.tar.gz

php-5.6.31.tar.xz

wordpress-4.8.1-zh_CN.tar.gz

xcache-3.2.0.tar.gz


1

yum groupinstall "development tools"

yum install openssl-devel expat-devel pcre-devel bzip2-devel libxml2-devel libmcrypt-devel


2 編譯httpd2.4

tar xvf apr-1.6.2.tar.gz

tar xvf apr-util-1.6.0.tar.gz

tar xvf httpd-2.4.28.tar.bz2

mv apr-1.6.2 httpd-2.4.28/srclib/apr

mv apr-util-1.6.0 httpd-2.4.28/srclib/apr-util



cd /root/src/httpd-2.4.28

./configure --prefix=/app/httpd24 \

--enable-so \

--enable-ssl \

--enable-cgi \

--enable-rewrite \

--with-zlib \

--with-pcre \

--with-included-apr \

--enable-modules=most \

--enable-mpms-shared=all \

--with-mpm=prefork


make -j 4 && make install


vim /etc/profile.d/lamp.sh

PATH=/app/httpd24/bin:/usr/local/mysql/bin/:/app/php/bin/:$PATH


. /etc/profile.d/lamp.sh

cp /etc/init.d/httpd /etc/init.d/httpd24

vim /etc/init.d/httpd24

chkconfig --add httpd24

service httpd24 start


3 二進制安裝mariadb-5.5.57


4 編譯安裝php-5.6.31


cd /root/src/php-5.6.31


./configure \

--prefix=/app/php \

--with-mysql=/usr/local/mysql \

--with-openssl \

--with-mysqli=/usr/local/mysql/bin/mysql_config \

--enable-mbstring \

--with-freetype-dir \

--with-jpeg-dir \

--with-png-dir \

--with-zlib \

--with-libxml-dir=/usr \

--enable-xml \

--enable-sockets \

--enable-fpm \

--with-mcrypt \

--with-config-file-path=/etc/php/ \

--with-config-file-scan-dir=/etc/php.d \

--with-bz2



make -j 4 && make install


cp php.ini-production /etc/php/php.ini

cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

chmod +x /etc/init.d/php-fpm

chkconfig --add php-fpm


cp /app/php/etc/php-fpm.conf.default /app/php/etc/php-fpm.conf


service php-fpm start

ss -ntl



5 配置httpd支持php

vim /app/httpd24/conf/httpd.conf

去掉下面兩行註釋

LoadModule proxy_module modules/mod_proxy.so

LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so


修改下面行

DirectoryIndexindex.phpindex.html


加下面四行

AddType application/x-httpd-php .php

AddType application/x-httpd-php-source .phps

ProxyRequests Off

ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/app/httpd24/htdocs/$1


6 布署wordpress


ab 測試性能


7 編譯安裝xcache

tar xvf xcache-3.2.0.tar.gz

cd xcache-3.2.0

./configure --enable-xcache --with-php-config=/app/php/bin/php-config

make && make install

mkdir /etc/php.d/

cp xcache.ini /etc/php.d/

ls /app/php/lib/php/extensions/no-debug-non-zts-20131226/

vim /etc/php.d/xcache.ini

extension = /app/php/lib/php/extensions/no-debug-non-zts-20131226/xcache.so 修改此行


service php-fpm restart



8 測試

phpinfo() 確認xcache 已加載

ab 測試性能



logger -p local1.info ‘This is a local1.info log‘


本文出自 “Linux” 博客,謝絕轉載!

實驗:CentOS6編譯LAMP基於FPM模式的應用wordpress