分散展開LNMP + WordPress

Nginxサービスの展開

まず、以前に構築した仮想マシンを使用し
ます
。①接続→マスタースレーブデータベース②接続→
Nginx③接続→PHP

①nginxノード構成

[root@nginx ~]# vi /usr/local/nginx/conf/nginx.conf
#access_log  logs/host.access.log  main;

   location / {
    
    
            root   /www;                            #更改网页目录
            index  index.php index.html index.htm;       #添加index.php
        }
        ....(此处省略部分)

   location ~ \.php$ {
    
                       #去掉location前面的注释
            root     /www;         #更改目录为/www
            fastcgi_pass   192.168.128.42:9000;      #这里添加PHP主机地址
            #IP地址
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
            include        fastcgi_params;
        }

ここに写真の説明を挿入

[root@nginx ~]# vi /usr/local/nginx/conf/fastcgi_params

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
#文件中添加上面这一行代码
fastcgi_param  REQUEST_URI        $request_uri;

②ユーザーとユーザーグループを作成する

ファイル転送ツール(ブロガーはxftpを使用)を使用して、wordpressインストールパッケージをnginxノードに配置し、PHPノード/ usr / local / srcディレクトリを
wordpressインストールパッケージリンク(ここではバージョンwordpress-4.7.3を使用)
リンクの下に配置します。 :Https//pan.baidu.com/s/12c7fjyVBvknzh0lp_PRHYg
抽出コード:4730

Nginxノード

[root@nginx ~]# mkdir /www           #创建目录
[root@nginx ~]# chown nginx:nginx /www/    #修改用户和用户组为nginx
[root@nginx ~]# yum -y install unzip      #安装解压工具
[root@nginx ~]# unzip wordpress-4.7.3-zh_CN.zip 
[root@nginx ~]# mv wordpress/* /www/      #移动文件

PHPノード

[root@php ~]# mkdir /www
[root@php ~]# chown nginx:nginx /www/     #修改用户和用户组为nginx

[root@php ~]# yum -y install unzip
[root@php ~]# unzip wordpress-4.7.3-zh_CN.zip 
[root@php ~]# mv wordpress/* /www/

③ワードプレスファイルを設定する

nginxノード

[root@nginx ~]# cp /www/wp-config-sample.php /www/wp-config.php   (重命名)
[root@nginx ~]# vi /www/wp-config.php  
按照以下进行修改
// ** MySQL 设置 - 具体信息来自您正在使用的主机 ** //
/** WordPress数据库的名称 */
define('DB_NAME', 'wordpress');         (数据库名称)

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

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

/** MySQL主机 */
define('DB_HOST', '192.168.128.111');   (主数据库ip)

/** 创建数据表时默认的文字编码 */
define('DB_CHARSET', 'utf8');           (数据库编码)

/** 数据库整理类型。如不确定请勿更改 */
define('DB_COLLATE', '');

変更された構成ファイルは、PHPノードに直接転送されます

[root@nginx ~]# scp /www/wp-config.php root@192.168.128.144:/www/      (PHP节点ip地址)
      (scp进PHP节点)
The authenticity of host '192.168.128.144 (192.168.128.144)' can't be established.
ECDSA key fingerprint is 43:9c:67:d7:3f:06:53:60:43:d4:41:5f:af:3a:67:01.
Are you sure you want to continue connecting (yes/no)? yes   (确认是否进行连接)
Warning: Permanently added '192.168.128.144' (ECDSA) to the list of known hosts.
root@192.168.128.144's password:       (PHP节点的密码)
wp-config.php                                                     100% 2909     2.8KB/s   00:00   (传输进度)

④データベースノード構成

メインデータベースノード

[root@mysql0 ~]# mysql -uroot -pSICT
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 7
Server version: 5.5.44-MariaDB-log MariaDB Server

Copyright (c) 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
[root@mysql0 ~]# 

⑤WordPressアプリケーションを確認する

Nginx节点
[root @ nginx〜] #nginx -s reload

ブラウザにnginxアドレスを入力します。
ここに写真の説明を挿入
有名なWordPressの5分間インストーラーが表示され、必要な情報を入力してから、左下隅にある[InstallWordPress]ボタンをクリックしてWordPressアプリケーションをインストールします。

おすすめ

転載: blog.csdn.net/planetoid_a/article/details/109300182