大前提:
- 源码编译 :apache php-fpm
二进制安装:mariadb
- 编译顺序:apache
mariadb
php-fpm
- 环境:
centos7.4
apr-1.6.3.tar.gz
apr-util-1.6.1.tar.gz
httpd-2.4.33.tar.bz2
mariadb-10.2.15-linux-x86_64.tar.gz
php-7.1.18.tar.bz2
wordpress-4.9.4-zh_CN.tar.gz
小前提:
yum groupinstall “development tools”
yum install pcre-devel openssl-devel expat-devel libxml2-devel bzip2-devel libmcrypt-devel
编译安装apache
环境准备:
tar xvf apr-1.6.3.tar.gz
tar xvf apr-util-1.6.1.tar.gz
tar xvf httpd-2.4.33.tar.bz2
mv apr-1.6.3 httpd-2.4.33/srclib/apr
mv apr-util-1.6.1 httpd-2.4.33/srclib/apr-util/
cd httpd-2.4.33/
编译:
./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 /app/httpd24/conf/httpd.conf
取消下面两行的注释
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
修改下面行
<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>
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
配置安装wordpress
tar xvf wordpress-4.9.4-zh_CN.tar.gz -C /app/httpd24/htdocs/
mv /app/httpd24/htdocs/wordpress/* /app/httpd24/htdocs/
rm -rf wordpress/
二进制安装:mariadb
tar xvf mariadb-10.2.15-linux-x86_64.tar.gz -C /usr/local/
cd /usr/local/
ln -sv mariadb-10.2.15-linux-x86_64/ mysql
chown -R root:mysql /usr/local/mysql/
useradd -r -s /sbin/nologin mysql
mkdir /data/mysql -pv
chown mysql.mysql /data/mysql/
cd /usr/local/mysql/
./scripts/mysql_install_db –datadir=/date/mysql –user=mysql
cp support-files/my-huge.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
vim /etc/profile.d/lamp.sh
PATH=/appl/httpd24/bin:/usr/local/mysql/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
. /etc/profile.d/lamp.sh
vim /etc/my.cnf
datadir=/data/mysql
chkconfig –list
chkconfig –add mysqld
service mysqld start
编译安装 fastcgi 模式的php
tar xvf php-7.1.18.tar.bz2
./configure –prefix=/app/php \
–enable-mysqlnd \
–with-mysqli=mysqlnd \
–with-openssl \
–with-pdo-mysql=mysqlnd \
–enable-mbstring \
–with-freetype-dir \
–with-jpeg-dir \
–with-png-dir \
–with-zlib \
–with-libxml-dir=/usr \
–enable-xml \
–enable-sockets \
–enable-fpm \
–with-config-file-path=/etc \
–with-config-file-scan-dir=/etc/php.d \
–enable-maintainer-zts \
–disable-fileinfo
make -j 4 && make install
cd /root/srcs/php-7.1.18/
cp php.ini-production /etc/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
chkconfig php-fpm on
cd /app/php/etc
cp php-fpm.conf.default php-fpm.conf
cp php-fpm.d/www.conf.default php-fpm.d/www.conf
vim /etc/profile.d/lamp.sh
. /etc/profile.d/lamp.sh
service php-fpm start
PATH最后的内容
vim /etc/profile.d/lamp.sh
PATH=/app/php/bin:/app/php/sbin:/app/httpd24/bin:/usr/local/mysql/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
最后的测试很重要
本文来自投稿,不代表Linux运维部落立场,如若转载,请注明出处:http://www.178linux.com/101576