WordPress单节点部署

  1. WordPress单节点部署
    2.1 基础服务安装
    (1)安装基础服务并启动,命令如下所示。
    [root@localhost ~]# yum -y install nginx mariadb-server php php-mysql php-devel
    php-pdo php-fpm
    [root@localhost ~]# systemctl start nginx mariadb php-fpm
    2.2 Nginx服务配置
    (1)在Nginx配置文件中配置启动文件,命令如下,结果如图2-1所示。
    [root@localhost ~]# vi /etc/nginx/conf.d/default.conf
    在这里插入图片描述

图2-1 Nginx配置文件
(2)接着在/etc/nginx/fastcgi_params添加一行配置,命令如下。
[root@localhost ~]# vi /etc/nginx/fastcgi_params
fastcgi_param SCRIPT_FILENAME d o c u m e n t r o o t document_root documentrootfastcgi_script_name;
2.3 MySQL服务配置
(1)将安装好的数据库进行初始化设置,并配置初始密码为000000,命令和结果如下所示。
[root@localhost ~]# mysql_secure_installation
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] n
… skipping.
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!
    (2)使用用户和密码登录数据库,并创建一个名为wordpress的数据库,命令和结果如下所示。
    [root@localhost ~]# mysql -uroot -p000000
    Welcome to the MariaDB monitor. Commands end with ; or \g.
    Your MariaDB connection id is 9
    Server version: 5.5.44-MariaDB MariaDB Server
    Copyright © 2000, 2015, Oracle, MariaDB Corporation Ab and others.
    Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
    MariaDB [(none)]> create database wordpress;
    Query OK, 1 row affected (0.00 sec)
    MariaDB [(none)]> exit
    Bye
    2.4 PHP服务配置
    (1)将WordPress服务的压缩包解压到本地,并拷贝到Nginx配置文件下,命令如下所示。
    [root@localhost ~]# unzip wordpress-4.7.3-zh_CN.zip
    [root@localhost ~]# cp -avr wordpress/* /usr/share/nginx/html/
    (2)在Nginx配置文件下,修改WordPress应用的配置文件,WordPress应用提供了wp-config-sample.php模板文件,将模板文件复制为wp-config.php,并修改,命令和结果如下所示。
    [root@localhost html]# cp wp-config-sample.php wp-config.php
    [root@localhost html]# vi wp-config.php
    …省略…
    // ** MySQL 设置 - 具体信息来自您正在使用的主机 ** //
    /** WordPress 数据库的名称 /
    define(‘DB_NAME’, ‘wordpress’);
    /
    * MySQL 数据库用户名 /
    define(‘DB_USER’, ‘root’);
    /
    * MySQL 数据库密码 /
    define(‘DB_PASSWORD’, ‘000000’);
    /
    * MySQL 主机 /
    define(‘DB_HOST’, ‘localhost’);
    /
    * 创建数据表时默认的文字编码 /
    define(‘DB_CHARSET’, ‘utf8’);
    /
    * 数据库整理类型。如不确定请勿更改 */
    define(‘DB_COLLATE’, ‘’);
    …省略…
    (3)在浏览器中输入http://192.168.200.4地址进行访问,会出现WordPress 五分钟安装程序,填写必要的信息,然后单击左下角“安装WordPress”按钮,进行WordPress应用的安装,如图2-2所示。
    在这里插入图片描述

图2-2 WordPress安装界面
稍等片刻,安装完毕后,进入WordPress后台界面,如图2-3所示。
在这里插入图片描述

图2-3 WordPress首页

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值