环境:
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
1安装包:
yum groupinstall "development tools"
yum install pcre-devel openssl-devel expat-devel libxml2-devel bzip2-devel libmcrypt-devel
2 编译安装httpd
./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 && make install
2 配置mysql
tar xvf mariadb-10.2.15-linux-x86_64.tar.gz -C /usr/local/
cd /usr/local/
ln -s mariadb-10.2.15-linux-x86_64/ mysql
useradd -r -s /sbin/nologin mysql
chown -R mysql.mysql mysql/
mkdir /data/mysql -pv
chown mysql.mysql /data/mysql/
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
./scripts/mysql_install_db --datadir=/data/mysql --user=mysql
cp support-files/my-huge.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
vim /etc/my.cnf
datadir=/data/mysql
chkconfig --add mysqld
chkconfig --list
service mysqld start
ss -ntl
mysql >create database wpdb;
mysql >grant all on wpdb.* to wpuser@'192.168.30.%' identified by 'centos';
3编译安装 fastcgi 模式的php
./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
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
service php-fpm start
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
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