您的位置:新葡亰496net > 电脑系统 > centos下行使LAMP免费搭建WordPress博客,CentOS7下安装

centos下行使LAMP免费搭建WordPress博客,CentOS7下安装

发布时间:2019-10-13 11:57编辑:电脑系统浏览(110)

      此次尝试策动3台CentOS7服务器,版本号:CentOS Linux release 7.2.1511。

    (1)配置概要:
      1、 172.18.17.7主机械运输维httpd php服务(php为模块专门的职业情势)
      配置两台虚构主机:wordpress个人博客系统、PHPmyadmin远程序调整制mysql

    刚接触了LAMP(Linux Apache Mysql Perl/PHP/Python),想在LAMP上搭个wordpress玩玩,下边是一对笔记

    centos下选拔LAMP无需付费搭建WordPress博客

    WordPress是选取PHP语言开采的博客平台,客户能够在支撑PHP和MySQL数据库的服务器上架设属于本人的网址。也足以把 WordPress充任三个剧情管理系列(CMS)来采用。 WordPress是一款民用博客系统,并逐年蜕形成一款内容管理种类软件,它是运用PHP语言和MySQL数据库开采的。客商能够在扶持PHP 和 MySQL数据库的服务器上接纳本身的博客。

    条件认证:

    在一样台主机上贯彻LAMP(Linux Apache MariaDB PHP)
    CentOS 7.3、Apache 2.4.6、MariaDB 5.5.52、PHP 5.4.16

    1 安装LAMP

    行使yum方式展开设置httpd、MariaDB、php、php-mysql,php-mysql用来开展php和MariaDB数据库的连天。

    [[email protected] ~]# yum install httpd mariadb-server php php-mysql -y
    

    2 创造新的虚构主机(1)新添设想主机配置文件

    [[email protected] ~]# vim /etc/httpd/conf.d/vhost.confDocumentRoot "/var/www/wordpress"ServerName www.mywordpress.com<Directory "/var/www/wordpress">AllowOverride NoneRequire all granted
    

    (2)创制所需目录

    [[email protected] ~]# mkdir /var/www/wordpress
    

    3 在设想主机主目录/var/www/wordpress下新建index.php文件

    [[email protected] ~]# vim /var/www/wordpress/index.php<!--?php phpinfo(); ?-->
    

    4 检查语法并运营httpd服务(1)检查语法

    [[email protected] ~]# httpd -tSyntax OK
    

    (2)启动httpd服务

    [[email protected] ~]# systemctl start httpd.service
    

    5 测试

    在浏览器中输入www.mywordpress.com

    新葡亰496net 1

    能够看看PHP私下认可页面已经成功展示,表达测量试验成功

    6 下载wordpress压缩包,wordpress-4.7.4-zh_CN.tar.gz(1)解压缩

    [[email protected] ~]# tar -xf wordpress-4.7.4-zh_CN.tar.gz
    

    (2)把解压缩后获得的文本(wordpress)复制到DocumentRoot(/var/www/wordpress/)下

    [[email protected] ~]# cp -a wordpress /var/www/wordpress/
    

    7 启动MariaDB服务

    [[email protected] ~]# systemctl start mariadb
    

    8 经过浏览器访谈wordpress

    在浏览器中输入

    注意:配置DNS服务器分析www.test.com 为192.168.29.100
    或者 修改windows 下的C:WindowsSysteme32driversetchosts文件
    192.168.29.100 www.test.com

    新葡亰496net 2

    能够看看已经出了wordpress 页面,能够点击“现在就起来”就行安插,也足以手动修改配置文件

    9 更动wordpress配置文件(1)步向WordPress目录(/var/www/wordpress/wordpress/)

    [[email protected] ~]# cd /var/www/wordpress/wordpress/
    

    (2)复制cp wp-config-sample.php模板文件为 wp-config.php,然后编辑

    [[email protected] ~]# vim /var/www/wordpress/wordpress/wp-config.php// ** MySQL 设置 - 具体信息来自您正在使用的主机 ** ///** WordPress数据库的名称 */define('DB_NAME', 'wordpress');/** MySQL数据库用户名 */define('DB_USER', 'test1');/** MySQL数据库密码 */define('DB_PASSWORD', '123456');/** MySQL主机 */define('DB_HOST', 'localhost');
    

    10 在数据库中创建数据库和客商(1)创设数据库

    MariaDB [(none)]> create database wordpress;Query OK, 1 row affected (0.00 sec)
    

    (2)创立顾客

    MariaDB [(none)]> create user 'test1'@'localhost' identified by '123456';Query OK, 0 rows affected (0.00 sec)
    

    (3)给客户授权

    MariaDB [(none)]> grant all on wordpress.* to 'test1'@'localhost';Query OK, 0 rows affected (0.01 sec)
    

    11 再一次访谈WordPress

    新葡亰496net 3
    填入有关音讯,就能够健康访问博客了。
    新葡亰496net 4

    WordPress是应用PHP语言开采的博客平台,客户能够在支撑PHP和MySQL数据库的服务器上架设属于本身的网址。...

    新葡亰496net 5

      2、172.18.17.8主机运营mariadb服务(mysql)

    搭建蒙受

    CentOS

    搭建Apache服务器

    • 通过 yum -y install httpd 安装Apache:

    新葡亰496net 6

    • 做客符合规律:

    新葡亰496net 7

    • 修改配置文件,增加2个虚构主机,一个提供phpMyAdmin,贰个提供wordpress:

      [root@happiness ~]# vim /etc/httpd/conf/httpd.conf #启用剖判,加快httpd服务的启航

      ServerName localhost:80
      

      #注销暗许主目录

      #DocumentRoot "/var/www/html"
      

      [root@happiness ~]# vim /etc/httpd/conf.d/vhost.conf #暗中认可主页

      DirectoryIndex index.php
      

      #虚构主机a,前期提供phpMyAdmin

      <VirtualHost 192.168.4.119:80>
          ServerName www.aaa.net
          DocumentRoot /var/www/aaa
          ProxyRequests off 
          ProxyPassMatch ^/(.*.php)$ fcgi://192.168.4.118:9000/var/www/php_aaa/$1
          <Directory "/var/www/aaa">
              Options None
              Allowoverride None
              Require all granted
          </Directory>
      </VirtualHost>
      

      #虚构主机b,前期提供wordpress

      <VirtualHost 192.168.4.119:80>
          ServerName www.bbb.net
          DocumentRoot /var/www/bbb
          ProxyRequests off 
          ProxyPassMatch ^/(.*.php)$ fcgi://192.168.4.118:9000/var/www/php_bbb/$1
          <Directory "/var/www/bbb">
              Options None
              Allowoverride None
              Require all granted
          </Directory>
      </VirtualHost>
      
    • 测试2个虚构主机静态财富是或不是可用:

      #在设想主机a中新建测试页aaa.html [root@happiness ~]# vim /var/www/aaa/aaa.html

      <h1>test virtualhost aaa</h1>
      

      #在设想主机b中新建测验页bbb.html [root@happiness ~]# vim /var/www/bbb/bbb.html

      <h1>test virtualhost bbb</h1>
      

      访问结果:(实验中没搭建dns服务,修改要访谈Apache的主机的hosts文件,增多 192.168.4.119  www.aaa.net 和 192.168.4.119  www.bbb.net,来变成访问)

    新葡亰496net 8   新葡亰496net 9

    (2)配置流程:
      首先配置172.18.17.7主机:http服务           
      1、安装程序:
    [root@johnson's linux ~]# yum install httpd php php-mysql php-mbstring

    所需软件

    1. httpd
    2. mysql
    3. mysql-server
    4. php
    5. php-devel
    6. php-mysql
    7. phpMyAdmin新葡亰496net 10

    地点的前6项,yum一下就有了,都是暗中认可安装。而phpMyAdmin提供了链接,手动安装。

    搭建php服务器

    •  通过 yum -y install php-fpm php-mysql php-mbstring 搭建php:

    新葡亰496net 11

    • 修改php配置文件:

      [root@happiness ~]# vim /etc/php-fpm.d/www.conf #监听本地能与表面通讯的地点

      listen = 192.168.4.118:9000
      

      #允许哪些主机访问

      listen.allowed_clients = 192.168.4.119
      

      #确保user、group跟Apache服务器httpd进程的user、group一致

      user = apache
      group = apache
      

      #session目录不设有,要求手动成立

      php_value[session.save_path] = /var/lib/php/session
      

      [root@happiness ~]# mkdir /var/lib/php/session [root@happiness ~]# chown apache:apache /var/lib/php/session [root@happiness ~]# ll -hd /var/lib/php/session/

      drwxr-xr-x. 2 apache apache 4.0K Jun 21 10:28 /var/lib/php/session/
      

      #虚拟机a新建php测试页 [root@happiness ~]# cat /var/www/php_aaa/index.php

      <h1>a</h1>
      <?php
              phpinfo();
      ?>
      

      #虚拟机b新建php测试页 [root@happiness ~]# cat /var/www/php_bbb/testbbb.php

      <h1>b</h1>
      <?php
          phpinfo();
      ?>
      

      做客结果:(注意,如若访问结果出现:File not found类似的唤醒时,供给关闭php服务器的selinux,有的时候关门通过命令 setenforce Permissive 举行,永恒关闭修改配置文件 vim /etc/sysconfig/selinux)

    新葡亰496net 12  新葡亰496net 13

     

     Package              Arch            Version                     

    Apache的主干配置

    1. /etc/httpd/conf/httpd.conf 是apache的首要安顿文件,修改基本的参数就OK,这里对于IP正是localhost了。
    2. //www/html 是CentOS暗许的“首页”所在目录,输入"
    3. 任何的Apache配置在这里处没有须求,所以不详细介绍。
    4. Apache的启动 /etc/init.d/httpd start,关闭/etc/init.d/httpd stop。测试 netstat -tunl | grep ‘:80’

     搭建Mariadb服务器

    • 通过 yum -y install mariadb-server 安装mariadb:

    新葡亰496net 14

    • 制造mariadb客户访谈权限:

      MariaDB [(none)]> CREATE USER 'wpuser'@'192.168.4.118' IDENTIFIED BY 'wppasswd'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON wordpressdb. TO 'wpuser'@'192.168.4.118'; MariaDB [(none)]> CREATE USER 'pmauser'@'192.168.4.118' IDENTIFIED BY 'pmapasswd'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON pmadb. TO 'pmauser'@'192.168.4.118'; MariaDB 新葡亰496net,[(none)]> FULSH PRIVILEGES; MariaDB [(none)]> CREATE DATABASE wordpressdb DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; MariaDB [(none)]> CREATE DATABASE pmadb DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

    • 分别在编造机a和b中创建测验页,看好不好打响总是mariadb服务器:

      [root@happiness ~]# cat /var/www/php_aaa/mysql_conn.php

      <h1>aaa</h1>
      <?php
          $conn = mysql_connect('192.168.4.117','pmauser','pmapasswd');
          if($conn)
              echo "aaa connects successfully";
          else
              echo "aaa fails to connect.";
      ?>
      

      [root@happiness ~]# cat /var/www/php_bbb/mysql_conn.php

      <h1>bbb</h1>
      <?php
          $conn = mysql_connect('192.168.4.117','wpuser','wppasswd');
          if($conn)
              echo "bbb connects successfully.";
          else
              echo "bbb fails to connect.";
      ?>
      

      探问结果:

    Repository    Size

    Installing:
     httpd                x86_64          2.4.6-40.el7.CentOS          base          2.7 M
     php                  x86_64          5.4.16-36.el7_1              base          1.4 M
     php-mbstring          x86_64          5.4.16-36.el7_1              base          503 k
     php-mysql            x86_64          5.4.16-36.el7_1              base          99 k  

    php测试

    能够在 /var/www/html/ 上边写入php文件,这里写二个测验文件

    $ vim /etc/www/html/phpinfo.php

    <?php phpinfo(); ?>
    

    下一场在浏览器输入 若突显出中央消息则象征OK。

    搭建phpMyAdmin和WordPress

    • 分级从官网下载 phpMyAdmin 和 WordPress 源码包,分别解压于对应的虚构机主目录下:(此时新星的 phpMyAdmin-4.8.1版本仅帮忙 PHP 5.5 to 7.2 and MySQL 5.5,而实验中PHP版本为5.4,故下载了 phpMyAdmin-4.4.15.10版本)

    新葡亰496net 15

    • 搭建phpMyAdmin:

      #修改phpMyAdmin配置文件 [root@happiness ~]# vim /var/www/php_aaa/phpmyadmin/libraries/config.default.php #可经过 openssl rand -base64 32 随机字符串   $cfg['blowfish_secret'] = 'w14hLCZeyOtg4 9izK9O3oW8BLjTpJVAzF1GCAtJ7U4=';   $cfg['Servers'][$i]['host'] = '192.168.4.117';   $cfg['Servers'][$i]['user'] = 'pmauser';   $cfg['Servers'][$i]['password'] = 'pmapasswd';

      #修改完配置后复制一整份 phpmyadmin文件到Apache服务器 [root@happiness ~]# scp -r /var/www/php_aaa/phpmyadmin/ root@192.168.4.119:/var/www/aaa/

      访问结果:

    •  搭建WordPress:

      #修改WordPress配置文件 [root@happiness ~]# cp /var/www/php_bbb/wordpress/wp-config-sample.php /var/www/php_bbb/wordpress/wp-config.php [root@happiness ~]# vim /var/www/php_bbb/wordpress/wp-config.php   define('DB_NAME', 'wordpressdb');   define('DB_USER', 'wpuser');   define('DB_PASSWORD', 'wppasswd');   define('DB_HOST', '192.168.4.117');

      #修改完配置后复制一整份wordpress到Apache服务器: [root@happiness ~]# scp -r /var/www/php_bbb/wordpress root@192.168.4.119:/var/www/bbb/

      寻访结果:

    Transaction Summary

    httpd:提供web服务
    php:安装后自动编写翻译为httpd的模块,用于拍卖动态财富php脚本
    php-mbstring:此程序包为phpMyAdmin远程调节mysql所不可不的
    php-mysql:php驱动mysql的库文件程序包

    2、服务配置

    包都安装完毕今后,步入下一步的配置阶段:

    (1)增加设想主机:(基于FQDN)
      虚构主机有二种配备格局:一种是基于不一致ip,同样端口(80),二是相同IP不一样端口,三是同一IP分裂主机名(FQDN),不管何种配置格局,最终深入分析到的主机唯有一台,不过在乞求报文首部音讯会有不一样!以下,仅演示基于FQDN的配备形式

        编辑:/etc/httpd/conf.d/vhost.conf文件
    [root@johnson's linux ~]# vim /etc/httpd/conf.d/vhost.conf 
    # 增多如下内容,基于FQDN的虚构主机配置
    <VirtualHost 172.18.17.7:80>  # 固定语法 <VirtualHost ip:port>可忽视大小写
        ServerName  # 很入眼,基于FQDN的虚构主机必得求有主机名 
        DocumentRoot "/www/host/htdoc" # 设想主机根目录,可内定路线 
    <Directory "/www/host/htdoc">  # 对设想主机根目录的权柄设置
        Options FollowSymLinks    # FollowSymLinks  代表能够访谈标识连接能源
        require all Granted    # 目录的权杖设置
    </Directory>               
    </VirtualHost>
     
    <VirtualHost 172.18.17.7:80>
        ServerName www.myadmin.com
        DocumentRoot "/www/host2/htdoc"
    <Directory "/www/host2/htdoc">
        Options FollowSymLinks
        require all Granted
    </Directory>
    </VirtualHost>

    Options:为个目录的选项,能够钦命多少个特点
        如:Index,运营财富索引,其成效是在客商在探望钦命的UENCOREL不设不时,再次回到web能源索引,此选项
    充裕危急,不提议启用,否则源码则会web源码揭露,后果相当的惨痛

    做客权限设定:
    Require all Granted/deny, Granted代表同意,all表示全体,deny表示拒绝
        供给留意的是:CentOS7是默认拒绝全数主机访谈DocumentRoot的财富,所以,配置虚构主机必定要配置此先参数

    (2)为虚拟主机创立布局文件中定义的财富目录并
    [root@johnson's linux ~]# mkdir/www/{host,host2}/htdoc

    (3)加多测验能源
    [root@johnson's linux ~]# vim /www/host/htdoc/index.php
    # 前面这段是测量检验php与mysql连通性的PHP代码
    <?php
        $conn = mysql_connect('172.18.17.8','admin','admin'); # ip填写mysql主机ip
        if ($conn)                                          # 顾客为mysql所授权的客户,密码空
            echo "DATABASE Connet OK";
        else
            echo "DATABASE Connet Failure";
    ?>
    # 测量检验php是或不是健康办事的php代码
    <?php
        phpinfo() #此函数调用会展现php的详细消息
    ?>

    (4)配置httpd主配置文件
    编辑:/etc/httpd/conf/httpd.conf
    [root@johnson's linux ~]# vim /etc/httpd/conf/httpd.conf
    # 找到 DocumentRoot "/var/www/html" ,#将其注释掉,平时选取虚构机都要批注掉,幸免矛盾
    #DocumentRoot "/var/www/html"
     
    # 加多php主页索引
    DirectoryIndex index.php index.html # 将index.php加多在前面,那样就能够私下认可访问此类财富索引
     
    # 裁撤服务器名称注释

    (5)运转服务,测量试验是还是不是健康
    # 检查实验配置文件语法有没错误
    [root@johnson's linux ~]# httpd -t
    # 语法正确运维服务
    [root@johnson's linux ~]# systemctl start httpd.service

    开发网页查看服务是不是正规   

    新葡亰496net 16   

    http服务测量检验日常,php模块也能健康事业,可是,如你所见,mysql的连日是败退,因为大家还mysql的服务器还平素不安插

    上边关于LAMP相关的开始和结果你或许也喜欢

    LAMP平台安夸口cache和Memcached加快网址运转  http://www.linuxidc.com/Linux/2015-06/118835.htm 

    CentOS 7下搭建LAMP平台情形  http://www.linuxidc.com/Linux/2015-06/118818.htm

    CentOS 6.5系统装置配备LAMP(Apache PHP5 MySQL)服务器意况 http://www.linuxidc.com/Linux/2014-12/111030.htm

    Ubuntu 14.04 配置 LAMP phpMyAdmin PHP(5.5.9)开辟景况  http://www.linuxidc.com/Linux/2014-10/107924.htm

    Ubuntu 14.10 下安装 LAMP 服务图文详解  http://www.linuxidc.com/Linux/2014-12/110082.htm

    LAMP结合NFS创设小型博客站点  http://www.linuxidc.com/Linux/2015-08/121029.htm

    (5)获取wordpress和phpmyadmin
    博主的是在局域网中ftp服务器中下载的
    wordpress配置:

    # 下载并解压至/www/host/htdoc
    # cd 到wordpress目录 ,配置文件如下
    [root@johnson's linux wordpress]# ls
    index.php        wp-blog-header.php    wp-cron.php        wp-mail.php
    license.txt      wp-comments-post.php  wp-includes        wp-settings.php
    readme.html      wp-links-opml.php    wp-signup.php
    wp-activate.php  wp-config-sample.php  wp-load.php        wp-trackback.php
    wp-admin        wp-content            wp-login.php      xmlrpc.php
     
    # 复制配置文件以上的 wp-config-sample.php 为 wp-config.php
    [root@johnson's linux wordpress]# cp wp-config-sample.php  wp-config.php
     
    # 编辑配置文件
    [root@johnson's linux wordpress]# vim wp-config.php
    // ** MySQL 设置 - 具体新闻来自您正在使用的主机 ** //
    /** WordPress数据库的名称 */
    define('DB_NAME', 'wpdb');  # 此填写mysql所要授权数据库的名字(前面会布置)
     
    /** MySQL数据库客户名 */
     
    define('DB_USER', 'wpuser'); # 填写数据库的客商名
     
    /** MySQL数据库密码 */
    define('DB_PASSWORD', 'wppasswd'); # 填写多少的密码
     
    /** MySQL主机 */
    define('DB_HOST', '172.18.17.8'); # 填写mysql主机的ip
     
    /** 创建数量表时私下认可的文字编码 */
    define('DB_CHARSET', 'utf8');
     
    /** 数据库整理项目。如不明确请勿退换 */
    define('DB_COLLATE', '');

     

    phpmyadmin配置:
    1234567891011121314151617181920212223242526272829303132 # 将包下载并解压至/www/host2/htdoc
    # cd 到 文件目录
    # 创设符号连接
    [root@johnson's linux htdoc]# ln -s phpMyAdmin-4.4.14.1-all-languages myadmin
    [root@johnson's linux htdoc]# ls
    index.php  phpMyAdmin-4.4.14.1-all-languages 
    myadmin    phpMyAdmin-4.4.14.1-all-languages.zip 
     
    #cd 至myadmin 目录里面,修改配置文件
    [root@johnson's linux htdoc]# cp config.sample.inc.php config.inc.php
     
    #编写制定配置文件
    [root@johnson's linux htdoc]# vim config.inc.php
    $cfg['blowfish_secret'] = 'o71mI9rimj6syc00fT3g'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
                    #单引号填写随机密码,可使用openssl rand -base64 15(密码长度)生成
                             
    /*
     * Servers configuration
     */
    $i = 0;
     
    /*
     * First server
     */
    $i ;
    /* Authentication type */
    $cfg['Servers'][$i]['auth_type'] = 'cookie';
    /* Server parameters */
    $cfg['Servers'][$i]['host'] = '172.18.17.8';  # 数据库主机ip 
    $cfg['Servers'][$i]['connect_type'] = 'tcp';
    $cfg['Servers'][$i]['compress'] = false;
    $cfg['Servers'][$i]['AllowNoPassword'] = false;

     

     


    172.18.17.8主机配置:mysql服务

    (1)yum安装程序
    1234567891011121314151617 [root@johnson's linux ~]# yum install mariadb-server

    Mysql的开发银行和测量检验

    1. Mysql的启动:/etc/init.dmysqld start
    2. 测试:netstat -tunl | grep ':3306'
    3. 手动连接mysql : mysql -u root
    4. 安装root密码登录: mysqladmin -u root password 'password'
    5. 登入:mysql -u root -p
    6. 登录到mysql后,通过create database wordpress ; (注意加分号)创造一个数据库
    7. show databases ;查看数据库
    8. exit 退出

     依靠php-xcache加快访谈

    •  没安装php-xcache进行的下压力测量试验:

      [root@happiness ~]# ab -n 10000 -c 1000 This is ApacheBench, Version 2.3 <$Revision: 1430300 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, Licensed to The Apache Software Foundation,

      Benchmarking www.bbb.net (be patient) Completed 1000 requests Completed 2000 requests Completed 3000 requests Completed 4000 requests Completed 5000 requests Completed 6000 requests Completed 7000 requests Completed 8000 requests Completed 9000 requests Completed 10000 requests Finished 10000 requests

    Server Software:        Apache/2.4.6
    Server Hostname:        www.bbb.net
    Server Port:            80
    
    Document Path:          /wordpress
    Document Length:        237 bytes
    
    Concurrency Level:      1000
    Time taken for tests:   12.966 seconds
    Complete requests:      10000
    Failed requests:        0
    Write errors:           0
    Non-2xx responses:      10000
    Total transferred:      4650000 bytes
    HTML transferred:       2370000 bytes
    Requests per second:    771.26 [#/sec] (mean)
    Time per request:       1296.588 [ms] (mean)
    Time per request:       1.297 [ms] (mean, across all concurrent requests)
    Transfer rate:          350.23 [Kbytes/sec] received
    
    Connection Times (ms)
                  min  mean[ /-sd] median   max
    Connect:        0   47 206.0      0    1004
    Processing:     5  136 1056.6     14   12899
    Waiting:        1  136 1056.6     14   12899
    Total:         10  183 1085.0     15   12947
    
    Percentage of the requests served within a certain time (ms)
      50%     15
      66%     15
      75%     16
      80%     17
      90%     25
      95%   1208
      98%   1676
      99%   1679
     100%  12947 (longest request)
    
    • 在php服务器上通过 yum -y install php-cache 安装cache:

    新葡亰496net 17

    • systemctl reload php-fpm.service,并扩充压力测验,能够见见访谈速度有了比相当的大升高:

      [root@happiness ~]# ab -n 10000 -c 1000 This is ApacheBench, Version 2.3 <$Revision: 1430300 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, Licensed to The Apache Software Foundation,

      Benchmarking www.bbb.net (be patient) Completed 1000 requests Completed 2000 requests Completed 3000 requests Completed 4000 requests Completed 5000 requests Completed 6000 requests Completed 7000 requests Completed 8000 requests Completed 9000 requests Completed 10000 requests Finished 10000 requests

    Server Software:        Apache/2.4.6
    Server Hostname:        www.bbb.net
    Server Port:            80
    
    Document Path:          /wordpress
    Document Length:        237 bytes
    
    Concurrency Level:      1000
    Time taken for tests:   1.973 seconds
    Complete requests:      10000
    Failed requests:        0
    Write errors:           0
    Non-2xx responses:      10000
    Total transferred:      4650000 bytes
    HTML transferred:       2370000 bytes
    Requests per second:    5068.89 [#/sec] (mean)
    Time per request:       197.282 [ms] (mean)
    Time per request:       0.197 [ms] (mean, across all concurrent requests)
    Transfer rate:          2301.79 [Kbytes/sec] received
    
    Connection Times (ms)
                  min  mean[ /-sd] median   max
    Connect:        0   56 220.6      4    1011
    Processing:     5   39  90.4     13    1102
    Waiting:        1   36  90.5     10    1101
    Total:         10   95 245.2     16    1222
    
    Percentage of the requests served within a certain time (ms)
      50%     16
      66%     17
      75%     19
      80%     20
      90%    220
      95%   1019
      98%   1029
      99%   1213
     100%   1222 (longest request)
    
    • 修改xcache配置文件,修改缓存大小为100M,再进行压力测验,能够看来访问速度略有进步:

      [root@happiness ~]# vim /etc/php.d/xcache.ini

      xcache.size  =  100M
      

      [root@happiness ~]# ab -n 10000 -c 1000 This is ApacheBench, Version 2.3 <$Revision: 1430300 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, Licensed to The Apache Software Foundation,

      Benchmarking www.bbb.net (be patient) Completed 1000 requests Completed 2000 requests Completed 3000 requests Completed 4000 requests Completed 5000 requests Completed 6000 requests Completed 7000 requests Completed 8000 requests Completed 9000 requests Completed 10000 requests Finished 10000 requests

    Server Software:        Apache/2.4.6
    Server Hostname:        www.bbb.net
    Server Port:            80
    
    Document Path:          /wordpress
    Document Length:        237 bytes
    
    Concurrency Level:      1000
    Time taken for tests:   1.642 seconds
    Complete requests:      10000
    Failed requests:        0
    Write errors:           0
    Non-2xx responses:      10000
    Total transferred:      4650000 bytes
    HTML transferred:       2370000 bytes
    Requests per second:    6088.82 [#/sec] (mean)
    Time per request:       164.235 [ms] (mean)
    Time per request:       0.164 [ms] (mean, across all concurrent requests)
    Transfer rate:          2764.94 [Kbytes/sec] received
    
    Connection Times (ms)
                  min  mean[ /-sd] median   max
    Connect:        0   57 226.4      3    1011
    Processing:     6   49 171.5     11    1613
    Waiting:        1   47 171.7      8    1612
    Total:          8  106 310.0     14    1636
    
    Percentage of the requests served within a certain time (ms)
      50%     14
      66%     16
      75%     22
      80%     23
      90%    219
      95%   1028
      98%   1409
      99%   1418
     100%   1636 (longest request)
    

     

     

    Installing:
     mariadb-server              x86_64      1:5.5.44-2.el7.centos        base      11 M
    Installing for dependencies:
     mariadb                      x86_64      1:5.5.44-2.el7.centos        base      8.9 M
     perl-Compress-Raw-Bzip2      x86_64      2.061-3.el7                  base      32 k
     perl-Compress-Raw-Zlib      x86_64      1:2.061-4.el7                base      57 k
     perl-DBD-MySQL              x86_64      4.023-5.el7                  base      140 k
     perl-DBI                    x86_64      1.627-4.el7                  base      802 k
     perl-IO-Compress            noarch      2.061-2.el7                  base      260 k
     perl-Net-Daemon              noarch      0.48-5.el7                    base      51 k
     perl-PlRPC                  noarch      0.2020-14.el7                base      36 k  

    安装wordpress

    1. 解压woordpress.tar.bz2到 /var/www/html/目录下
    2. cp wp-config-sample.php  wp-config.php  备份配置文件
    3. # vi wp-config.php  #编排配置文件,输入数据库名、客商名以至密码
      // * MySQL设置 - 具体音讯来源您正在使用的主机 ** //
      /** WordPress数据库的称号,替换掉 “putyourdbnamehere” */
      define('DB_NAME', 'wordpress');
      /** MySQL数据库客商名,替换掉 “usernamehere” */
      define('DB_USER', 'root');
      /** MySQL数据库密码,替换掉 “yourpasswordhere” */*
      define('DB_PASSWORD', 'password');

    Transaction Summary

    一大推重视包,只要有yum在且yum源配置没不日常,能够轻易解决

     

    (2)运转服务,推行安全安装操作
    12345678910111213141516171819202122232425262728293031323334353637383940414243444546 [root@johnson's linux ~]# systemctl start mariadb
    # 查看监听端口,3306为mariaDB的暗许监听端口
    [root@johnson's linux ~]# ss -tnl
    State      Recv-Q Send-Q Local Address:Port              Peer Address:Port             
    LISTEN    0      50              *:3306                        *:*                 
    LISTEN    0      128              *:22                          *:*                 
    LISTEN    0      128            :::22                          :::*   
     
    施行安全设置操作 
    [root@johnson's linux ~]# mysql_secure_installation 
     
    Setting the root password ensures that nobody can log into the MariaDB
    root user without the proper authorisation.
     
    Set root password? [Y/n] y  # 设置管理员登入秘密(此密码和linux系统的root没提到)
     
    New password: 
    Re-enter new password:    # 输入密码就能够
    Password updated successfully!
    Reloading privilege tables..
     ... Success!
     
    Remove anonymous users? [centos下行使LAMP免费搭建WordPress博客,CentOS7下安装配备LAMP意况。Y/n] y  # 是还是不是移除无名顾客(在试行安全设置以前无需密码登入)
     ... Success!                    # 允许无名登录时很凶险的,提出移除
     
    Disallow root login remotely? [Y/n] n  # 是不是不容许管理员账号远程登录,平日景况下提出不相同意
     ... skipping.                       
     
    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!

    生硬建议在mariaDB安装到位后实行安全安装操作,那样能够使得数据库更安全

    新葡亰496net 18

    安装phpmyadmin

    1. 把phpmyadmin的压缩文件解压到 /var/www/html/
    2. cd /var/www/html/phpMyAdmin/phpMyAdmin-3.4.10.1-all-languages/
      #进去到布署目录
    3. cp config.sample.inc.php config.inc.php #备份配置文件
    4. vi config.inc.php
      修改
      // $cfg['Servers'][$i]['controluser'] = 'pma';
      // $cfg['Servers'][$i]['controlpass'] = 'pmapass';

      $cfg['Servers'][$i]['controluser'] = 'root';  #mysql登陆客商名
      $cfg['Servers'][$i]['controlpass'] = 'password';  #mysql登入密码
    5. 测试 :
    6. 用帐号和密码登录,在此个中能够操作你的数据库,对于wordpress,大家曾在在命令行里建设构造了。

    接下去就能够配备wordpress了。

    新葡亰496net 19

    本文由新葡亰496net发布于电脑系统,转载请注明出处:centos下行使LAMP免费搭建WordPress博客,CentOS7下安装

    关键词:

上一篇:Linux日志文件总管,ubuntu日志文件管理

下一篇:没有了