Centos7上编译安装LAMP
分类:pc28.am神测网

 

系统版本: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

 

预备干活
编写翻译软件供给选拔开垦包组Development tools,在编写翻译httpd中,会信任openssl-devel pcre-devel expat-devel五个devel包,提前设置,幸免进程中报错。

(三)二进制安装MariaDB

  • 解压缩二进制包至钦赐目录
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

  • Centos7上编译安装LAMP。编写翻译景况准备
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

(三)二进制安装MariaDB

  • 解压缩二进制包至钦命目录
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

(三)二进制安装MariaDB

  • 解压缩二进制包至内定目录
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:编辑_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

设置到位

本文由pc28.am发布于pc28.am神测网,转载请注明出处:Centos7上编译安装LAMP

上一篇:退出vi编辑格局,vi编辑命令 下一篇:没有了
猜你喜欢
热门排行
精彩图文
  • 退出vi编辑格局,vi编辑命令
    退出vi编辑格局,vi编辑命令
    CentOS 7 vi编辑命令 用vi张开叁个yum文件 vi /usr/bin/yum 按 i 键后  走入insert格局,进入insert情势后手艺拓展更换 修改达成后 按esc键进入command模式, 然后:wq
  • 关于打开新窗口同时关闭原窗口出现的问题,G
    关于打开新窗口同时关闭原窗口出现的问题,G
    Ctrl c:复制 v:粘贴 z:撤销 a:全选 关于打开新窗口同时关闭原窗口出现的问题 三个窗口间,点击第一个窗口的按钮,打开第二个窗口,同时关闭第一个窗口,在
  • crontab的两种配置方式,out持续累加问题
    crontab的两种配置方式,out持续累加问题
    废话不多说,直接上菜了 在LINUX中,周期执行的任务一般由cron这个守护进程来处理[ps -ef|grepcron]。cron读取一个或多个配置文件,这些配置文件中包含了命令
  • vim常用操作,vim编辑器的使用
    vim常用操作,vim编辑器的使用
    vim是linux下效果卓殊强劲的文书编辑器,因为是命令操作,所以读书来比较累,下边计算一下常用的几点操作。 常用情势: 经常方式(Normal mode) 插入格局
  • Debian系统的安装,OpenSUSE系统的安装
    Debian系统的安装,OpenSUSE系统的安装
                  又过了相比长的时间,基本上都是十七日一更了,这期咱们就来演示Linux系统中OpenSUSE系统的装置吧!         新的七日,新的一天又来了