系统版本:CentOS 6.9

  • CentOS 7.3条件LAMP源码编译安装WordPress
  • CentOS 6.9环境LAMP源码编译安装WordPress(php module格局)
  • CentOS 6.9环境LAMP源码编译安装WordPress(php fpm方式)

试验环境:
虚拟机CentOS7,ip为172.16.250.103

前言

前不久没更新新篇幅了,先天就来点干活,过多的也不说了上面伊始干!干!干!

 

软件包

一、CentOS 7.3环境LAMP源码编译安装WordPress

官网上下载软件包:

安不忘忧条件

centos7.5
apr-1.6.3.tar.gz 
apr-util-1.6.1.tar.gz     
httpd-2.4.34.tar.bz2                
php-7.1.18.tar.bz2
mariadb-10.2.16-linux-x86_64.tar.gz 
wordpress-4.9.4-zh_CN.tar.gz

apr-1.6.2.tar.gz
apr-util-1.6.0.tar.gz
httpd-2.4.27.tar.bz2
mariadb-5.5.57-linux-x86_64.tar.gz
php-5.6.31.tar.bz2
wordpress-4.8.1-zh_CN.zip

(一)环境准备

  • 搭建环境:
    主机1:负责httpd, php, wordpress (IP: 192.168.136.130)
    主机2:负责MariaDB (IP: 192.168.136.230)

  • 软件条件:
    apr-1.6.2.tar.gz
    apr-util-1.6.0.tar.gz
    httpd-2.4.27.tar.bz2
    php-7.1.10.tar.xz
    wordpress-4.8.1-zh_CN.tar.gz
    mariadb-10.2.8-linux-x86_64.tar.gz

  • apr-1.5.2.tar.bz2
  • apr-util-1.5.4.tar.bz2
  • httpd-2.4.27.tar.bz2
  • mariadb-10.2.7-linux-x86_64.tar.gz
  • php-7.1.8.tar.bz2
  • wordpress-4.8-zh_CN.tar.gz
  • xcache-3.2.0.tar.gz

编译HTTP

编译安装httpd

(二)源码编译安装httpd2.4

  • 设置开发条件

yum groupinstall "development tools"
yum install openssl-devel expat-devel pcre-devel
  • 解压缩源码包

tar xvf apr-1.6.2.tar.gz -C /usr/local/src
tar xvf apr-util-1.6.0.tar.gz  -C /usr/local/src
tar xvf httpd-2.4.27.tar.bz -C /usr/local/src
cd /usr/local/src
cp -r apr-1.6.2 httpd-2.4.27/srclib/apr
cp -r apr-util-1.6.0 httpd-2.4.27/srclib/apr-util
cd httpd-2.4.27/
  • 编译安装

./configure --prefix=/app/httpd24 --sysconfdir=/etc/httpd24 --enable-so --enable-ssl --enable-rewrite --with-zlib --with-pcre --with-included-apr --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork
make -j 4 && make install

澳门金沙国际 1

澳门金沙国际 2

  • 修改环境变量

vim /etc/profile.d/lamp.sh
PATH=/app/httpd24/bin/:$PATH
. /etc/profile.d/lamp.sh
apachectl start
ss -ntlp
  • 设置开机启动脚本

vim /etc/rc.d/rc.local
/app/httpd24/bin/apachectl start
chmod +x /etc/rc.d/rc.local
  • 设置协理文件路径

vim /etc/man_db.conf
MANDATORY_MANPATH    /app/httpd24/man

地点的软件包除了mariadb是二进制包,其余的包都是源码包,近期已下载完结,放在/root/src目录下:

1、安装包组以及相关包

yum groupinstall "development tools"
yum install pcre-devel openssl-devel expat-devel

 

准备工作
再就是安顿wordpress博客。编译软件须求利用开发包组Development
tools,在编译httpd中,会器重openssl-devel pcre-devel
expat-devel三个devel包,提前安装,避免进程中报错。

(三)二进制安装玛丽亚DB

  • 解压缩二进制包至指定目录

tar xvf mariadb-10.2.8-linux-x86_64.tar.gz -C /usr/local
cd /usr/local/
ln -s mariadb-10.2.8-linux-x86_64/ mysql
  • 安装数据库

useradd -r -d /app/mysqldb -s /sbin/nologin mysql -m
cd mysql/
scripts/mysql_install_db  --datadir=/app/mysqldb --user=mysql

澳门金沙国际 3

  • 编排配置文件

mkdir /etc/mysql
cp support-files/my-large.cnf /etc/mysql/my.cnf
vim /etc/mysql/my.cnf
[mysqld]     //添加以下三行
datadir = /app/mysqldb
innodb_file_per_table = ON
skip_name_resolve = ON
  • 设置启动脚本

cp support-files/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig --list mysqld
  • 设置日志目录,并启动服务

mkdir /var/log/mariadb
chown mysql /var/log/mariadb/
service mysqld start
ss -ntlp
  • 设置环境变量

vim /etc/profile.d/lamp.sh
PATH=/usr/local/mysql/bin:$PATH
source /etc/profile.d/lamp.sh 
  • 安插数据库,建立WordPress的数据库

mysql_secure_installation

mysql -uroot -p
MariaDB [(none)]> create database wpdb;
MariaDB [(none)]> grant all on wpdb.* to wpadmin@'192.168.136.%' identified by 'centos';
MariaDB [(none)]> grant all on wpdb.* to wpadmin@'127.%' identified by 'centos';
MariaDB [(none)]> grant all on wpdb.* to wpadmin@'localhost' identified by 'centos';

澳门金沙国际 4

[root@Centos7 src]#pwd
/root/src
[root@Centos7 src]#ls
apr-1.5.2.tar.bz2       mariadb-10.2.7-linux-x86_64.tar.gz  wordpress-4.8-zh_CN.tar.gz
apr-util-1.5.4.tar.bz2  httpd-2.4.27.tar.bz2  php-7.1.8.tar.bz2   xcache-3.2.0.tar.gz

2、创立用户与解压

useradd  -r -s /sbin/nologin apache 
tar xf httpd-2.4.34.tar.bz2 
tar xf apr-1.6.3.tar.gz 
tar xf apr-util-1.6.1.tar.gz 

 

[root@6mini ~]# yum groupinstall "Development tools"
[root@6mini ~]# yum install openssl-devel pcre-devel expat-devel

(四)源码编译安装php

  • 编译环境准备

yum install libxml2-devel bzip2-devel libmcrypt-devel
tar xvf php-7.1.10.tar.xz -C /usr/local/src/
cd /usr/local/src/php-7.1.10/
  • 编译安装

./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 --with-apxs2=/app/httpd24/bin/apxs --with-mcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --enable-maintainer-zts --disable-fileinfo
make -j 4 && make install

澳门金沙国际 5

澳门金沙国际 6

  • 编制配置文件

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

vim /etc/httpd24/httpd.conf
// 在文件尾部加两行
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
// 修改下面行
<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>

apachectl stop
apachectl start
ss -ntlp

一、编译安装httpd

1、解压httpd、apr、apr-util七个安装包

[root@Centos7 src]#tar xvf httpd-2.4.27.tar.bz2
[root@Centos7 src]#tar xvf apr-1.5.2.tar.bz2
[root@Centos7 src]#tar xvf apr-util-1.5.4.tar.bz2

2、把apr和apr-util解压出来的目录移动到httpd-2.4.27/srclib/apr这一个目录下

[root@Centos7 src]#mv apr-1.5.2 httpd-2.4.27/srclib/apr
[root@Centos7 src]#mv apr-util-1.5.4 httpd-2.4.27/srclib/apr-util

3、进入httpd-2.4.27目录,执行./configure,检查当前条件,生成Makefile
只要提醒缺少某个模块恐怕软件,依据须要装上,然再执行./configure,直到没有报错。

[root@Centos7 src]#cd httpd-2.4.27/
[root@Centos7 httpd-2.4.27]#./configure --prefix=/app/apache24  --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

4、编译安装

[root@Centos7 httpd-2.4.27]#make &&make install

5、修改PATH,把/app/apache24/bin添加到PATH变量里

[root@Centos7 app]#vim /etc/profile.d/app.sh
export PATH=/app/apache24/bin:$PATH
[root@Centos7 app]#. /etc/profile.d/app.sh

6、到此地大家就可以启动httpd了,由于大家协调编译安装的,并从未增加服务脚本。由此我们只能够用Apache自带的指令启动服务。可以看到80端口已开拓。至此httpd已编译安装到位。

[root@Centos7 app]#apachectl start
[root@Centos7 app]#ss -ntl|grep 80
LISTEN     0      128         :::80                      :::*            

3、移动apr目录

mv apr-1.6.3 httpd-2.4.34/srclib/apr
mv apr-util-1.6.1 httpd-2.4.34/srclib/apr-util

 

解压apr-1.6.2.tar.gz、apr-util-1.6.0.tar.gz和httpd-2.4.27.tar.bz2,复制apr-1.6.2到httpd-2.4.27,并改名为apr,复制apr-util-1.6.0到httpd-2.4.27,并改名换姓为apr-util

(五)测试php与MariaDB的连接

vim /app/httpd24/htdocs/index.php
<?php
$mysqli=new mysqli("192.168.136.230","wpadmin","centos");
if(mysqli_connect_errno()){
echo "连接数据库失败!";
$mysqli=null;
exit;
}
echo "连接数据库成功!";
$mysqli->close();
phpinfo();
?>

澳门金沙国际 7

二、安装mariadb

由于本人用的软件包是官网上早已编译好的二进制包,编译时选定的目录是/usr/local/,由此我也解压到那么些目录下(否则安装后很多布署文件设置的和装置目录不雷同)
剔除原来安装的mariadb

[root@Centos7 src]#rpm -qa "mariadb*"
[root@Centos7 src]#yum remove  mariadb*

1、解压mariadb软件包到//usr/local/

[root@Centos7 src]#tar xvf mariadb-10.2.7-linux-x86_64.tar.gz  -C /usr/local/
[root@Centos7 src]# cd /usr/local/
[root@Centos7 local]#ln -s mariadb-10.2.7-linux-x86_64/ mysql

2、创立mysql用户,指定shell类型为nologin,并创建家目录为/app/mysqldb

[root@Centos7 local]#useradd -r mysql -s /sbin/nologin -d /app/mysqldb -m 
[root@Centos7 local]#ll -d /app/mysqldb/
drwx------. 2 mysql mysql 4096 Aug  9 08:17 /app/mysqldb/

3、安装,指定数据库目录以及服务用户

[root@Centos7 local]#cd mysql
[root@Centos7 mysql]#./scripts/mysql_install_db --datadir=/app/mysqldb --user=mysql

4、准备安插文件

[root@Centos7 mysql]#mkdir /etc/mysql
[root@Centos7 mysql]#cp support-files/my-huge.cnf /etc/mysql/my.cnf
[root@Centos7 mysql]#vim /etc/mysql/my.cnf 
#在[mysqld]这一行下添加以下三行
datadir =/app/mysqldb
innodb_file_per_table = ON
skip_name_resolve = ON

5、添加启动服务脚本

[root@Centos7 mysql]#cp support-files/mysql.server /etc/init.d/mysqld
[root@Centos7 mysql]#chkconfig --add mysqld

6、修改PATH路径

[root@Centos7 mysql]#vim /etc/profile.d/app.sh 
export PATH=/usr/local/mysql/bin:/app/apache24/bin:$PATH
[root@Centos7 mysql]#. /etc/profile.d/app.sh

7、启动服务

[root@Centos7 mysql]#service mysqld start
Starting mysqld (via systemctl):                           [  OK  ]
[root@Centos7 mysql]#ss -ntl |grep 3306
LISTEN     0      80          :::3306                    :::*    
可以看到3306端口已打开

8、修改mysql的root账号密码
上面会用到那一个root账号和密码测试

[root@Centos7 mysql]#mysql_secure_installation
设置root密码为666666

创立博客的数据库和用户

[root@Centos7 mysql]mysql -uroot -p666666
MariaDB [(none)]> create database blogdb;     
MariaDB [(none)]>grant all on blogdb.* to wpuser@'localhost' identified by  "666666";    

4、源码编译

cd httpd-2.4.34/

./configure --prefix=/app/httpd24 \
--enable-so \
--enable-ssl \
--enable-cgi \
--enable-rewrite \
--with-zlib \
--with-pcre \
--enable-modules=most \
--enable-mpms-shared=all \
--with-mpm=prefork \
--with-included-apr

make && make install 

 

[root@6mini ~]# tar xvf apr-1.6.2.tar.gz 
[root@6mini ~]# tar xvf apr-util-1.6.0.tar.gz 
[root@6mini ~]# tar xvf httpd-2.4.27.tar.bz2 

(六)安装配置WordPress

  • 解压缩软件包至网页存放目录

tar -xvf wordpress-4.8.1-zh_CN.tar.gz -C /app/httpd24/htdocs/
cd /app/httpd24/htdocs/
ln -s wordpress/ blog
cd blog/
  • 编写安装配置文件

cp wp-config-sample.php wp-config.php
vim wp-config.php
// ** MySQL 设置 - 具体信息来自您正在使用的主机 ** //
/** WordPress数据库的名称 */
define('DB_NAME', 'wpdb');

/** MySQL数据库用户名 */
define('DB_USER', 'wpadmin');

/** MySQL数据库密码 */
define('DB_PASSWORD', 'centos');

/** MySQL主机 */
define('DB_HOST', '192.168.136.230');
  • 浏览器打开http://192.168.136.130/blog/,依照提醒填入信息开端安装

澳门金沙国际 8

  • WordPress安装成功后,博客突显界面

澳门金沙国际 9

  • ab测试质量
    ab -c 10 -n 100 http://192.168.136.130/blog/

澳门金沙国际 10

三、编译PHP

1、解压源码包

[root@Centos7 src]#ls
apr-1.5.2.tar.bz2       httpd-2.4.27.tar.bz2                php-7.1.8.tar.bz2
apr-util-1.5.4.tar.bz2  mariadb-10.2.7-linux-x86_64.tar.gz  wordpress-4.8-zh_CN.tar.gz
httpd-2.4.27            php-7.1.8                           xcache-3.2.0.tar.gz
[root@Centos7 src]#tar xvf php-7.1.8.tar.bz2

2、./configure

[root@Centos7 src]#cd php-7.1.8/
[root@Centos7 php-7.1.8]#./configure --prefix=/app/php --enable-mysqlnd  --with-mysqli=mysqlnd   --with-openssl --enable-mbstring --with-png-dir --with-jpeg-dir --with-freetype-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-sockets --with-apxs2=/app/apache24/bin/apxs --with-mcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2
如果提示找不到文件,请按照提示安装包
安装好包后,继续上面./configure操作

3、make && make install

[root@Centos7 php-7.1.8]#make && make install

4、拷贝配置文件

[root@Centos7 php-7.1.8]cp php.ini-production  /etc/php.ini

5、修改httpd配置文件

[root@Centos7 php-7.1.8]vim /app/httpd24/conf/httpd.conf
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>

6、测试php
“root”,”666666″分别是自我下面安装的mysql数据库的账号和密码

vim /app/httpd24/htdocs/index.php 
<?php
$mysqli=new mysqli("127.0.0.1","root","666666");
if(mysqli_connect_errno()){
echo "连接数据库失败!";
$mysqli=null;
exit;
}
echo "连接数据库成功!";
$mysqli->close();
?>

用浏览器访问一下,使用php连接数据库成功

澳门金沙国际 11

image.png

5、设置环境变量

echo 'PATH=/app/httpd24/bin:$PATH' > /etc/profile.d/lamp.sh

 

编译安装httpd,配置环境变量

二、CentOS 6.9环境LAMP源码编译安装WordPress(php module格局)

四、部署WordPress

1、解压,把解压出来的目录移动到/app/apache24/htdocs/目录下,改名为blog

[root@Centos7 ~]#cd /root/src/
[root@Centos7 src]#tar xf wordpress-4.8-zh_CN.tar.gz 
[root@Centos7 src]mv wordpress /app/apache24/htdocs/blog

2、设置配置文件

[root@Centos7 src]#cd /app/apache24/htdocs/blog/
[root@Centos7 blog]cp wp-config-sample.php wp-config.php 
[root@Centos7 blog]vim wp-config.php 

define('DB_NAME', 'blogdb');

/** MySQL数据库用户名 */
define('DB_USER', 'wpuser');

/** MySQL数据库密码 */
define('DB_PASSWORD', '666666');

/** MySQL主机 */
define('DB_HOST', 'localhost');

也得以用另一种艺术,给予daemon读写执行权限

[root@Centos7 ~]setfacl -m u:daemon:rwx /app/apache24/htdocs/blog/

3、测试
自我的ip是172.16.250.103,访问一下http://172.16.250.103/blog/
可以见见陈设成功。

澳门金沙国际 12

image.png

6、编辑配置文件

vim /app/httpd24/conf/httpd.conf

user apache
group apache


取消下面注释
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so

在下面行添加index.php
IfModule dir_module>
    DirectoryIndex index.php index.html                                                                                       
</IfModule>

添加子配置文件
Include conf/extra/php.conf

 

[root@6mini httpd-2.4.27]# ./configure --prefix=/app/httpd24 
--enable-so --enable-ssl --enable-rewrite --with-zlib --with-pcre 
--with-included-apr --enable-modules=most 
--enable-mpms-shared=all --with-mpm=prefork
[root@6mini httpd-2.4.27]# make -j 2 && make install

[root@6mini httpd-2.4.27]# vim /etc/profile.d/lamp.sh
PASH=/app/httpd24/bin/:$PASH

[root@6mini httpd-2.4.27]# . /etc/profile.d/lamp.sh
[root@6mini httpd-2.4.27]# echo $PASH
/app/httpd24/bin/:

(一)环境准备

  • 搭建环境:
    主机1:负责httpd, php, wordpress (IP: 192.168.136.129)
    主机2:负责MariaDB (IP: 192.168.136.229)

  • 软件条件:
    apr-1.6.2.tar.gz
    apr-util-1.6.0.tar.gz
    httpd-2.4.27.tar.bz2
    php-5.6.4.tar.xz
    xcache-3.2.0.tar.bz2
    wordpress-4.8.1-zh_CN.tar.gz
    mariadb-5.5.57-linux-x86_64.tar.gz

7、编辑子配置文件

vim  /app/httpd24/conf/extra/php.conf

添加以下内容
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

 

成立httpd启动程序
复制其他主机上httpd的启动程序到当下主机并改名换姓为httpd24

(二)源码编译安装httpd2.4

  • 设置开发条件

yum groupinstall "development tools"
yum install openssl-devel expat-devel pcre-devel
  • 解压缩源码包

tar xvf apr-1.6.2.tar.gz -C /usr/local/src
tar xvf apr-util-1.6.0.tar.gz  -C /usr/local/src
tar xvf httpd-2.4.27.tar.bz -C /usr/local/src
cd /usr/local/src
cp -r apr-1.6.2 httpd-2.4.27/srclib/apr
cp -r apr-util-1.6.0 httpd-2.4.27/srclib/apr-util
cd httpd-2.4.27/
  • 编译安装

./configure --prefix=/app/httpd24 --enable-so --enable-ssl --enable-rewrite --with-zlib --with-pcre --with-included-apr --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork
make -j 4 && make install

澳门金沙国际 13

澳门金沙国际 14

  • 修改环境变量

vim /etc/profile.d/lamp.sh
PATH=/app/httpd24/bin/:$PATH
. /etc/profile.d/lamp.sh
  • 安装启动脚本

scp /etc/init.d/httpd  192.168.136.129:/etc/init.d/httpd24    //从其他主机复制脚本进行修改
vim /etc/init.d/httpd24
apachectl=/app/httpd24/bin/apachectl
httpd=${HTTPD-/app/httpd24/bin/httpd}
prog=httpd
pidfile=${PIDFILE-/app/httpd24/logs/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd24}

chkconfig --add httpd24
chkconfig --list httpd24
service httpd24 start
ss -ntlp
  • 安装扶助文件路径

vim /etc/man.config
MANPATH /app/httpd24/man

8、启动服务

apachectl

 

 

[root@MiniLinux ~]#scp /etc/init.d/httpd 192.168.163.105:/etc/init.d/
The authenticity of host '192.168.163.105 (192.168.163.105)' can't be established.
RSA key fingerprint is b5:df:3d:28:80:8e:d4:81:3b:f2:56:81:77:6d:7d:8a.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.163.105' (RSA) to the list of known hosts.
root@192.168.163.105's password: 
httpd                                                      100% 3488     3.4KB/s   00:00

[root@6mini httpd-2.4.27]# mv /etc/init.d/httpd /etc/init.d/httpd24

(三)二进制安装玛丽亚DB

  • 解压缩二进制包至指定目录

tar xvf mariadb-5.5.57-linux-x86_64.tar.gz -C /usr/local
cd /usr/local/
ln -s mariadb-5.5.57-linux-x86_64/ mysql
  • 设置数据库

useradd -r -d /app/mysqldb -s /sbin/nologin mysql -m
cd mysql/
scripts/mysql_install_db  --datadir=/app/mysqldb --user=mysql

澳门金沙国际 15

  • 编纂配置文件

mkdir /etc/mysql
cp support-files/my-large.cnf /etc/mysql/my.cnf
vim /etc/mysql/my.cnf
[mysqld]     //添加以下三行
datadir = /app/mysqldb
innodb_file_per_table = ON
skip_name_resolve = ON
  • 设置启动脚本

cp support-files/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig --list mysqld
  • 设置日志目录,并启动服务

touch /var/log/mysqld.log
chown mysql /var/log/mysqld.log
service mysqld start
ss -ntlp
  • 设置环境变量

vim /etc/profile.d/lamp.sh
PATH=/usr/local/mysql/bin:$PATH
source /etc/profile.d/lamp.sh 
  • 安插数据库,建立WordPress的数据库

mysql_secure_installation

mysql -uroot -p
MariaDB [(none)]> create database wpdb;
MariaDB [(none)]> grant all on wpdb.* to wpadmin@'192.168.136.%' identified by 'centos';
MariaDB [(none)]> grant all on wpdb.* to wpadmin@'127.%' identified by 'centos';
MariaDB [(none)]> grant all on wpdb.* to wpadmin@'localhost' identified by 'centos';

澳门金沙国际 16

二进制安装MYSQL

启动httpd24
修改httpd24的开行配置文件

(四)源码编译安装php

  • 编译环境准备

yum install libxml2-devel bzip2-devel libmcrypt-devel
tar xvf php-5.6.4.tar.xz -C /usr/local/src/
cd /usr/local/src/php-5.6.4/
  • 编译安装

./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 --with-apxs2=/app/httpd24/bin/apxs --with-mcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --enable-maintainer-zts --disable-fileinfo
make -j 4 && make install

澳门金沙国际 17

澳门金沙国际 18

  • 安装环境变量

vim /etc/profile.d/lamp.sh
PATH=/app/php/bin:/app/httpd24/bin:$PATH
source /etc/profile.d/lamp.sh
  • 编制配置文件

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

vim /app/httpd24/conf/httpd.conf
// 在文件尾部加两行
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
// 修改下面行
<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>

service httpd24 restart
ss -ntlp

1、在前几篇里有关联详细的装置进程,那里就一向工作代码

useradd -r -s /sbin/nologin mysql

tar xvf mariadb-10.2.16-linux-x86_64.tar.gz  -C /usr/local/

cd /usr/local/

ln -s mariadb-10.2.16-linux-x86_64/ mysql

chown -R mysql.mysql mysql/

mkdir /app/mysql

chown mysql.mysql /app/mysql

cd /usr/local/mysql/

scripts/mysql_install_db  --datadir=/app/mysql --user=mysql

mkdir /etc/mysql/  

cp support-files/my-huge.cnf  /etc/mysql/my.cnf

vim /etc/mysql/my.cnf

datadir=/app/mysql 

cp support-files/mysql.server  /etc/init.d/mysqld

chkconfig --add mysqld

chkconfig --list

service mysqld start

vim /etc/profile.d/lamp.sh 

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

mysql -e "create database wpdb;grant all on wpdb.* to wpuser@'localhost' identified by 'centos'"

 

备注:那里可以跑下mysql安全脚本,做下安全加固–请看https://www.cnblogs.com/xsuid/p/9368389.html

 

[root@6mini httpd-2.4.27]#vim /etc/init.d/httpd24

apachectl=/app/httpd24/bin/apachectl
httpd=${HTTPD-/app/httpd24/bin/httpd}
prog=httpd
pidfile=${PIDFILE-/app/httpd24/logs/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd24}

(五)测试php与MariaDB的连接

vim /app/httpd24/htdocs/index.php
<?php
$mysqli=new mysqli("192.168.136.229","wpadmin","centos");
if(mysqli_connect_errno()){
echo "连接数据库失败!";
$mysqli=null;
exit;
}
echo "连接数据库成功!";
$mysqli->close();
phpinfo();
?>

澳门金沙国际 19

PHP编译安装

把httpd24添加到服务列表

(六)安装配置WordPress

  • 解压缩软件包至网页存放目录

tar -xvf wordpress-4.8.1-zh_CN.tar.gz -C /app/httpd24/htdocs/
cd /app/httpd24/htdocs/
ln -s wordpress/ blog
cd blog/
  • 编辑安装配置文件

cp wp-config-sample.php wp-config.php
vim wp-config.php
// ** MySQL 设置 - 具体信息来自您正在使用的主机 ** //
/** WordPress数据库的名称 */
define('DB_NAME', 'wpdb');

/** MySQL数据库用户名 */
define('DB_USER', 'wpadmin');

/** MySQL数据库密码 */
define('DB_PASSWORD', 'centos');

/** MySQL主机 */
define('DB_HOST', '192.168.136.229');
  • 浏览器打开http://192.168.136.129/blog/,根据指示填入消息开首安装

澳门金沙国际 20

  • WordPress安装成功后,博客呈现界面

澳门金沙国际 21

  • ab测试品质
    ab -c 10 -n 100 http://192.168.136.129/blog/

澳门金沙国际 22

1、安装包与解压

yum install libxml2-devel bzip2-devel libmcrypt-devel

tar xvf php-7.1.18.tar.bz2 

 

[root@6mini httpd-2.4.27]#chkconfig --add httpd24
[root@6mini httpd-2.4.27]#chkconfig --list
auditd          0:off   1:off   2:on    3:on    4:on    5:on    6:off
blk-availability    0:off   1:on    2:on    3:on    4:on    5:on    6:off
crond           0:off   1:off   2:on    3:on    4:on    5:on    6:off
httpd24         0:off   1:off   2:off   3:off   4:off   5:off   6:off

(七)编译安装xcache

  • 解压缩源码包

tar xvf xcache-3.2.0.tar.bz2 -C /usr/local/src
cd /usr/local/src/xcache-3.2.0/
  • 编译安装

phpize     //生成configure文件
./configure  --enable-xcache --with-php-config=/app/php/bin/php-config
make && make install

澳门金沙国际 23

澳门金沙国际 24

  • 安装后安插

mkdir /etc/php.d
cp xcache.ini /etc/php.d/
vim /etc/php.d/xcache.ini
extension = /app/php/lib/php/extensions/no-debug-zts-20131226/xcache.so

service httpd24 restart
  • ab测试品质
    ab -c 10 -n 100 http://192.168.136.129/blog/

澳门金沙国际 25

2、源码编译

cd php-7.1.18/
./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

 

关门防火墙和selinux

三、CentOS 6.9环境LAMP源码编译安装WordPress(php fpm格局)

3、环境变量

vim  /etc/profile.d/lamp.sh
PATH=/app/php/bin:/app/httpd24/bin:/usr/local/mysql/bin:$PATH

 

[root@6mini httpd-2.4.27]#iptables -F
[root@6mini httpd-2.4.27]#iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination   

[root@6mini httpd-2.4.27]#vim /etc/selinux/config
SELINUX=disabled
[root@6mini httpd-2.4.27]#setenforce 0
[root@6mini httpd-2.4.27]#getenforce 
Permissive

(一)环境准备

  • 搭建环境:
    主机1:负责httpd, php, wordpress (IP: 192.168.136.129)
    主机2:负责MariaDB (IP: 192.168.136.229)

  • 软件条件:
    apr-1.6.2.tar.gz
    apr-util-1.6.0.tar.gz
    httpd-2.4.27.tar.bz2
    php-5.6.4.tar.xz
    xcache-3.2.0.tar.bz2
    wordpress-4.8.1-zh_CN.tar.gz
    mariadb-5.5.57-linux-x86_64.tar.gz

4、php设置

cp php.ini-production /etc/php.ini
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
PHP配置文件

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
php fastcgi配置文件,根据情况来更改

澳门金沙国际 26

澳门金沙国际 27

澳门金沙国际 28

 

检查/app/httpd24/logs/是不是变动

(二)源码编译安装httpd2.4

  • 安装开发环境

yum groupinstall "development tools"
yum install openssl-devel expat-devel pcre-devel
  • 解压缩源码包

tar xvf apr-1.6.2.tar.gz -C /usr/local/src
tar xvf apr-util-1.6.0.tar.gz  -C /usr/local/src
tar xvf httpd-2.4.27.tar.bz -C /usr/local/src
cd /usr/local/src
cp -r apr-1.6.2 httpd-2.4.27/srclib/apr
cp -r apr-util-1.6.0 httpd-2.4.27/srclib/apr-util
cd httpd-2.4.27/
  • 编译安装

./configure --prefix=/app/httpd24 --enable-so --enable-ssl --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/:$PATH
. /etc/profile.d/lamp.sh
  • 设置启动脚本

scp /etc/init.d/httpd  192.168.136.129:/etc/init.d/httpd24    //从其他主机复制脚本进行修改
vim /etc/init.d/httpd24
apachectl=/app/httpd24/bin/apachectl
httpd=${HTTPD-/app/httpd24/bin/httpd}
prog=httpd
pidfile=${PIDFILE-/app/httpd24/logs/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd24}

chkconfig --add httpd24
chkconfig --list httpd24
service httpd24 start
ss -ntlp
  • 设置帮衬文件路径

vim /etc/man.config
MANPATH /app/httpd24/man

5、启动服务

service php-fpm start

 

[root@6mini httpd-2.4.27]#ll /app/httpd24/logs/
total 8
-rw-r--r--. 1 root root   0 Oct 16 16:37 access_log
-rw-r--r--. 1 root root 246 Oct 16 16:37 error_log
-rw-r--r--. 1 root root   6 Oct 16 16:37 httpd.pid

(三)二进制安装玛丽亚DB

  • 解压缩二进制包至指定目录

tar xvf mariadb-5.5.57-linux-x86_64.tar.gz -C /usr/local
cd /usr/local/
ln -s mariadb-5.5.57-linux-x86_64/ mysql
  • 设置数据库

useradd -r -d /app/mysqldb -s /sbin/nologin mysql -m
cd mysql/
scripts/mysql_install_db  --datadir=/app/mysqldb --user=mysql
  • 编写配置文件

mkdir /etc/mysql
cp support-files/my-large.cnf /etc/mysql/my.cnf
vim /etc/mysql/my.cnf
[mysqld]     //添加以下三行
datadir = /app/mysqldb
innodb_file_per_table = ON
skip_name_resolve = ON
  • 安装启动脚本

cp support-files/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig --list mysqld
  • 安装日志目录,并启动服务

touch /var/log/mysqld.log
chown mysql /var/log/mysqld.log
service mysqld start
ss -ntlp
  • 设置环境变量

vim /etc/profile.d/lamp.sh
PATH=/usr/local/mysql/bin:$PATH
source /etc/profile.d/lamp.sh 
  • 安顿数据库,建立WordPress的数据库

mysql_secure_installation

mysql -uroot -p
MariaDB [(none)]> create database wpdb;
MariaDB [(none)]> grant all on wpdb.* to wpadmin@'192.168.136.%' identified by 'centos';
MariaDB [(none)]> grant all on wpdb.* to wpadmin@'127.%' identified by 'centos';
MariaDB [(none)]> grant all on wpdb.* to wpadmin@'localhost' identified by 'centos';

安装wordpress

tar xvf wordpress-4.9.4-zh_CN.tar.gz

cp -a wordpress/* /app/httpd24/htdocs/

cd /app/httpd24/htdocs/

mv wp-config-sample.php wp-config.php 

vim wp-config.php

根据上面mysql创建信息更改

澳门金沙国际 29

 

拔取curl检查httpd是还是不是能正常使用

(四)源码编译安装php

  • 编译环境准备

yum install libxml2-devel bzip2-devel libmcrypt-devel
tar xvf php-5.6.4.tar.xz -C /usr/local/src/
cd /usr/local/src/php-5.6.4/
  • 编译安装

./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-mcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --enable-maintainer-zts --disable-fileinfo
make -j 4 && make install

澳门金沙国际 30

澳门金沙国际 31

  • 设置环境变量

vim /etc/profile.d/lamp.sh
PATH=/app/php/bin:/app/httpd24/bin:$PATH
source /etc/profile.d/lamp.sh
  • 配置启动脚本

cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
chkconfig --add php-fpm
chkconfig --list php-fpm
  • 编排配置文件

cp php.ini-production /etc/php.ini
cd /app/php/etc/
cp php-fpm.conf.default php-fpm.conf

vim /app/httpd24/conf/httpd.conf
// 取消两行的注释
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
// 在文件尾部加两行
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
// 修改下面行
<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>

service php-fpm start
service httpd24 restart
ss -ntlp

叠加虚拟主机的贯彻

编辑文件
vim /etc/httpd/conf.d/vhosts.conf
DirectoryIndex  index.php
<VirtualHost *:80>
ServerName www.pma.com
DocumentRoot /var/www/html/
ProxyRequests Off
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/var/www/html/pma/$1
<Directory "/var/www/html">
Require all granted
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName www.wordpress.com
DocumentRoot /var/www/html/
ProxyRequests Off
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/var/www/html/wordpress/$1
<Directory "/var/www/html">
Require all granted
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName www.forum.com
DocumentRoot /var/www/html/
ProxyRequests Off
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/var/www/html/forum/$1
<Directory "/var/www/html">
Require all granted
</Directory>
</VirtualHost>

 

澳门金沙国际 , 

[root@6mini httpd-2.4.27]#curl 192.168.163.105
<html><body><h1>It works!</h1></body></html>

(五)测试php与MariaDB的连接

vim /app/httpd24/htdocs/index.php
<?php
$mysqli=new mysqli("192.168.136.229","wpadmin","centos");
if(mysqli_connect_errno()){
echo "连接数据库失败!";
$mysqli=null;
exit;
}
echo "连接数据库成功!";
$mysqli->close();
phpinfo();
?>

澳门金沙国际 32

停止语:后续更完美

二进制安装mariadb

(六)安装配置WordPress

  • 解压缩软件包至网页存放目录

tar -xvf wordpress-4.8.1-zh_CN.tar.gz -C /app/httpd24/htdocs/
cd /app/httpd24/htdocs/
ln -s wordpress/ blog
cd blog/
  • 编排安装配置文件

cp wp-config-sample.php wp-config.php
vim wp-config.php
// ** MySQL 设置 - 具体信息来自您正在使用的主机 ** //
/** WordPress数据库的名称 */
define('DB_NAME', 'wpdb');

/** MySQL数据库用户名 */
define('DB_USER', 'wpadmin');

/** MySQL数据库密码 */
define('DB_PASSWORD', 'centos');

/** MySQL主机 */
define('DB_HOST', '192.168.136.229');
  • 浏览器打开http://192.168.136.129/blog/,根据指示填入音讯开头安装

  • ab测试质量
    ab -c 10 -n 100 http://192.168.136.129/blog/

澳门金沙国际 33

解压二进制安装包到/usr/local/目录,把解压后的mariadb目录改名为mysql或然成立一个名为mysql的软连接

(七)编译安装xcache

  • 解压缩源码包

tar xvf xcache-3.2.0.tar.bz2 -C /usr/local/src
cd /usr/local/src/xcache-3.2.0/
  • 编译安装

phpize     //生成configure文件
./configure  --enable-xcache --with-php-config=/app/php/bin/php-config
make && make install
  • 安装后安顿

mkdir /etc/php.d
cp xcache.ini /etc/php.d/
vim /etc/php.d/xcache.ini
extension = /app/php/lib/php/extensions/no-debug-zts-20131226/xcache.so

service php-fpm restart
  • ab测试质量
    ab -c 10 -n 100 http://192.168.136.129/blog/

澳门金沙国际 34

通过来看:在php_fpm格局下,使用xcache加快功能进步卓殊醒目

[root@6mini local]#tar xvf mariadb-5.5.57-linux-x86_64.tar.gz -C /usr/local/
[root@6mini ~]#cd /usr/local/
[root@6mini local]#ls
bin  etc  games  include  lib  lib64  libexec  mariadb-5.5.57-linux-x86_64  sbin  share  src
[root@6mini local]#ln -s mariadb-5.5.57-linux-x86_64/ mysql
[root@6mini local]#ls
bin  games    lib    libexec                      mysql  share
etc  include  lib64  mariadb-5.5.57-linux-x86_64  sbin   src

编纂环境变量的安排文件,在文书中添加mysql环境变量

[root@6mini local]#vim /etc/profile.d/lamp.sh 
PASH=/app/httpd24/bin/:/usr/local/mysql/bin/:$PASH
[root@6mini local]#. /etc/profile.d/lamp.sh 
[root@6mini local]#echo $PASH
/app/httpd24/bin/:/usr/local/mysql/bin:/app/httpd24/bin/:

创办mysql用户,指定家目录为 /app/mysqldb,用户类型为系统用户

[root@6mini local]#useradd -r -m -d /app/mysqldb -s /sbin/nologin mysql
[root@6mini local]#getent passwd mysql
mysql:x:498:498::/app/mysqldb:/sbin/nologin

[root@6mini app]#ll -d mysqldb/
drwx------. 2 mysql mysql 4096 Oct 16 17:10 mysqldb/

运行scripts/mysql_install_db脚本,生成mysql文件,指定目录为/app/mysqldb/,指定用户为mysql

[root@6mini mysql]#scripts/mysql_install_db --datadir=/app/mysqldb/ --user=mysql
[root@6mini mysqldb]#ll /app/mysqldb/
total 32
-rw-rw----. 1 mysql mysql 16384 Oct 16 17:21 aria_log.00000001
-rw-rw----. 1 mysql mysql    52 Oct 16 17:21 aria_log_control
drwx------. 2 mysql root   4096 Oct 16 17:21 mysql
drwx------. 2 mysql mysql  4096 Oct 16 17:21 performance_schema
drwx------. 2 mysql root   4096 Oct 16 17:21 test

成立mysql配置文件

[root@6mini mysql]#mkdir /etc/mysql
[root@6mini mysql]#cp support-files/my-large.cnf /etc/mysql/my.cnf
[root@6mini mysql]#vim /etc/mysql/my.cnf
[mysqld]
datadir = /app/mysqldb
innodb_file_per_table = ON
skip_name_resolve = ON

复制mysql启动的劳动进程文件到/etc/init.d/,并该名称mysql添加到服务列表

[root@6mini mysql]#cp support-files/mysql.server /etc/init.d/mysqld
[root@6mini mysql]#chkconfig --add mysqld

创设日志文件,并予以mysql的写权限

[root@6mini mysql]#touch /var/log/mysqld.log
[root@6mini mysql]#chown mysql /var/log/mysqld.log
[root@6mini mysql]#ll /var/log/mysqld.log 
-rw-r--r--. 1 mysql root 0 Oct 16 17:39 /var/log/mysqld.log

启动mysql

[root@6mini mysql]#service mysqld start
Starting MySQL.171016 17:41:04 mysqld_safe Logging to '/var/log/mysqld.log'.
171016 17:41:04 mysqld_safe Starting mysqld daemon with databases from /app/mysqldb
.. SUCCESS! 

使用mysql_secure_installation初叶化数据库

[root@6mini bin]#mysql_secure_installation
/usr/local/mysql/bin/mysql_secure_installation: line 393: find_mysql_client: command not found

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

动用root登录数据库,为workpress创设数据库,并授权给用户wpu

[root@6mini bin]#mysql -uroot -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 12
Server version: 5.5.57-MariaDB MariaDB Server

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> CREATE DATABASE wpdb;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> GRANT ALL ON wpdb.* TO wpu@'%' IDENTIFIED BY 'centos';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> QUIT
Bye

应用wpu用户登录数据库,查看并认可数据库wpdb的变通

[root@6mini bin]#mysql -uwpu -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 13
Server version: 5.5.57-MariaDB MariaDB Server

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| wpdb               |
+--------------------+
2 rows in set (0.00 sec)

MariaDB [(none)]> 

源码编译php

编译安装php此前,首先安装php的珍重包libxml2-devel bzip2-devel
libmcrypt-devel,再展开编译安装

[root@6mini ~]#yum install libxml2-devel bzip2-devel libmcrypt-devel
[root@6mini ~]#tar xvf php-5.6.31.tar.bz2 
[root@6mini ~]#cd php-5.6.31
[root@6mini 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-png-dir --with-jpeg-dir --with-freetype-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-sockets --with-apxs2=/app/httpd24/bin/apxs --with-mcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2

[root@6mini php-5.6.31]# make -j 2 && make install

复制一个php的陈设文件,直接改名,不用安装

[root@6mini php-5.6.31]#cp php.ini-production /etc/php.ini

编写httpd的布置文件,使httpd辅助php

[root@6mini php-5.6.31]#vim /app/httpd24/conf/httpd.conf

<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.php index.html

测试php程序
第一启动httpd24,在主目录里编辑php测试页举行测试

[root@6mini php-5.6.31]#service httpd24 restart
Stopping httpd:                                            [  OK  ]
Starting httpd: AH00557: httpd: apr_sockaddr_info_get() failed for 6mini
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
                                                           [  OK  ]
[root@6mini php-5.6.31]#vim /app/httpd24/htdocs/index.php
<?php
phpinfo();
?>

应用浏览器查看php网页

澳门金沙国际 35

配置wordpress

解压wordpress到httpd主目录,并改名为blog

[root@6mini ~]#unzip wordpress-4.8.1-zh_CN.zip -d /app/httpd24/htdocs/
[root@6mini ~]#cd /app/httpd24/htdocs
[root@6mini htdocs]#mv wordpress/ blog

行使wordpress的安插模板生成配置文件,并修改数据库的新闻,确保数据库正常使用

[root@6mini htdocs]#cd blog/
[root@6mini blog]#mv wp-config-sample.php wp-config.php 
[root@6mini blog]#vim wp-config.php 

<?php
/**
 * WordPress基础配置文件。
 *
 * 这个文件被安装程序用于自动生成wp-config.php配置文件,
 * 您可以不使用网站,您需要手动复制这个文件,
 * 并重命名为“wp-config.php”,然后填入相关信息。
 *
 * 本文件包含以下配置选项:
 *
 * * MySQL设置
 * * 密钥
 * * 数据库表名前缀
 * * ABSPATH
 *
 * @link https://codex.wordpress.org/zh-cn:%E7%BC%96%E8%BE%91_wp-config.php
 *
 * @package WordPress
 */

// ** MySQL 设置 - 具体信息来自您正在使用的主机 ** //
/** WordPress数据库的名称 */
define('DB_NAME', 'wpdb');

/** MySQL数据库用户名 */
define('DB_USER', 'wpu');

/** MySQL数据库密码 */
define('DB_PASSWORD', 'centos');

/** MySQL主机 */
define('DB_HOST', 'localhost');

浏览器登录并陈设wordpress站点

http://192.168.163.105/blog

澳门金沙国际 36

澳门金沙国际 37

澳门金沙国际 38

澳门金沙国际 39

澳门金沙国际 40

安装到位

相关文章