综合架构-网站架构LNMP

综合架构-网站架构LNMP

  • 网站的LNMP架构是什么
  • 网站的LNMP架构部署
  • LNMP架构原理
  • 实现LNMP之间建立关系
  • 部署搭建网站页面(代码上线)
  • 关于LNMP的疑问

网站的LNMP架构是什么

  • L:linux系统
    注意:
    selinux关闭、防火墙关闭或者配置
  • N:nginx服务部署
    作用:
    处理用户的静态请求
  • P:php服务部署
    作用:
    处理动态的页面请求
    负责和数据库建立关系
  • M:mysql服务部署
    作用:
    存储用户的字符串数据信息

网站的LNMP架构部署

  • nginx服务安装
  • msyql的安装
  1. yum安装mariadb
[root@test01 ~]# yum install mariadb
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
base                                                                                                                                                                                       | 3.6 kB  00:00:00     
extras                                                                                                                                                                                     | 2.9 kB  00:00:00     
nginx-mainline                                                                                                                                                                             | 2.9 kB  00:00:00     
updates                                                                                                                                                                                    | 2.9 kB  00:00:00     
(1/2): nginx-mainline/7Server/x86_64/primary_db                                                                                                                                            | 227 kB  00:00:02     
(2/2): updates/x86_64/primary_db                                                                                                                                                           |  12 MB  00:00:03     
Resolving Dependencies
--> Running transaction check
---> Package mariadb.x86_64 1:5.5.68-1.el7 will be installed
--> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.68-1.el7 for package: 1:mariadb-5.5.68-1.el7.x86_64
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.56-2.el7 will be updated
---> Package mariadb-libs.x86_64 1:5.5.68-1.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================================================================================================
 Package                                              Arch                                           Version                                                   Repository                                    Size
==================================================================================================================================================================================================================
Installing:
 mariadb                                              x86_64                                         1:5.5.68-1.el7                                            base                                         8.8 M
Updating for dependencies:
 mariadb-libs                                         x86_64                                         1:5.5.68-1.el7                                            base                                         760 k

Transaction Summary
==================================================================================================================================================================================================================
Install  1 Package
Upgrade             ( 1 Dependent package)

Total download size: 9.5 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/2): mariadb-libs-5.5.68-1.el7.x86_64.rpm                                                                                                                                                | 760 kB  00:00:00     
(2/2): mariadb-5.5.68-1.el7.x86_64.rpm                                                                                                                                                     | 8.8 MB  00:00:02     
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                             3.3 MB/s | 9.5 MB  00:00:02     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : 1:mariadb-libs-5.5.68-1.el7.x86_64                                                                                                                                                             1/3 
  Installing : 1:mariadb-5.5.68-1.el7.x86_64                                                                                                                                                                  2/3 
  Cleanup    : 1:mariadb-libs-5.5.56-2.el7.x86_64                                                                                                                                                             3/3 
  Verifying  : 1:mariadb-libs-5.5.68-1.el7.x86_64                                                                                                                                                             1/3 
  Verifying  : 1:mariadb-5.5.68-1.el7.x86_64                                                                                                                                                                  2/3 
  Verifying  : 1:mariadb-libs-5.5.56-2.el7.x86_64                                                                                                                                                             3/3 

Installed:
  mariadb.x86_64 1:5.5.68-1.el7                                                                                                                                                                                   

Dependency Updated:
  mariadb-libs.x86_64 1:5.5.68-1.el7                                                                                                                                                                              

Complete!
[root@test01 ~]# yum install mariadb-server
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package mariadb-server.x86_64 1:5.5.68-1.el7 will be installed
--> Processing Dependency: perl-DBI for package: 1:mariadb-server-5.5.68-1.el7.x86_64
--> Processing Dependency: perl-DBD-MySQL for package: 1:mariadb-server-5.5.68-1.el7.x86_64
--> Processing Dependency: perl(Data::Dumper) for package: 1:mariadb-server-5.5.68-1.el7.x86_64
--> Processing Dependency: perl(DBI) for package: 1:mariadb-server-5.5.68-1.el7.x86_64
--> Running transaction check
---> Package perl-DBD-MySQL.x86_64 0:4.023-6.el7 will be installed
---> Package perl-DBI.x86_64 0:1.627-4.el7 will be installed
--> Processing Dependency: perl(RPC::PlServer) >= 0.2001 for package: perl-DBI-1.627-4.el7.x86_64
--> Processing Dependency: perl(RPC::PlClient) >= 0.2000 for package: perl-DBI-1.627-4.el7.x86_64
---> Package perl-Data-Dumper.x86_64 0:2.145-3.el7 will be installed
--> Running transaction check
---> Package perl-PlRPC.noarch 0:0.2020-14.el7 will be installed
--> Processing Dependency: perl(Net::Daemon) >= 0.13 for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Net::Daemon::Test) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Net::Daemon::Log) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Compress::Zlib) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Running transaction check
---> Package perl-IO-Compress.noarch 0:2.061-2.el7 will be installed
--> Processing Dependency: perl(Compress::Raw::Zlib) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
--> Processing Dependency: perl(Compress::Raw::Bzip2) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
---> Package perl-Net-Daemon.noarch 0:0.48-5.el7 will be installed
--> Running transaction check
---> Package perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 will be installed
---> Package perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================================================================================================
 Package                                                       Arch                                         Version                                              Repository                                  Size
==================================================================================================================================================================================================================
Installing:
 mariadb-server                                                x86_64                                       1:5.5.68-1.el7                                       base                                        11 M
Installing for dependencies:
 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-6.el7                                          base                                       140 k
 perl-DBI                                                      x86_64                                       1.627-4.el7                                          base                                       802 k
 perl-Data-Dumper                                              x86_64                                       2.145-3.el7                                          base                                        47 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

Transaction Summary
==================================================================================================================================================================================================================
Install  1 Package (+8 Dependent packages)

Total download size: 13 M
Installed size: 62 M
Is this ok [y/d/N]: y
Downloading packages:
(1/9): perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm                                                                                                                                      |  32 kB  00:00:00     
(2/9): perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm                                                                                                                                       |  57 kB  00:00:00     
(3/9): perl-DBD-MySQL-4.023-6.el7.x86_64.rpm                                                                                                                                               | 140 kB  00:00:00     
(4/9): perl-DBI-1.627-4.el7.x86_64.rpm                                                                                                                                                     | 802 kB  00:00:00     
(5/9): perl-Data-Dumper-2.145-3.el7.x86_64.rpm                                                                                                                                             |  47 kB  00:00:00     
(6/9): perl-IO-Compress-2.061-2.el7.noarch.rpm                                                                                                                                             | 260 kB  00:00:00     
(7/9): perl-Net-Daemon-0.48-5.el7.noarch.rpm                                                                                                                                               |  51 kB  00:00:00     
(8/9): perl-PlRPC-0.2020-14.el7.noarch.rpm                                                                                                                                                 |  36 kB  00:00:00     
(9/9): mariadb-server-5.5.68-1.el7.x86_64.rpm                                                                                                                                              |  11 MB  00:00:03     
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                             3.4 MB/s |  13 MB  00:00:03     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : perl-Data-Dumper-2.145-3.el7.x86_64                                                                                                                                                            1/9 
  Installing : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64                                                                                                                                                     2/9 
  Installing : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64                                                                                                                                                    3/9 
  Installing : perl-IO-Compress-2.061-2.el7.noarch                                                                                                                                                            4/9 
  Installing : perl-Net-Daemon-0.48-5.el7.noarch                                                                                                                                                              5/9 
  Installing : perl-PlRPC-0.2020-14.el7.noarch                                                                                                                                                                6/9 
  Installing : perl-DBI-1.627-4.el7.x86_64                                                                                                                                                                    7/9 
  Installing : perl-DBD-MySQL-4.023-6.el7.x86_64                                                                                                                                                              8/9 
  Installing : 1:mariadb-server-5.5.68-1.el7.x86_64                                                                                                                                                           9/9 
  Verifying  : perl-Net-Daemon-0.48-5.el7.noarch                                                                                                                                                              1/9 
  Verifying  : perl-Data-Dumper-2.145-3.el7.x86_64                                                                                                                                                            2/9 
  Verifying  : 1:mariadb-server-5.5.68-1.el7.x86_64                                                                                                                                                           3/9 
  Verifying  : perl-DBD-MySQL-4.023-6.el7.x86_64                                                                                                                                                              4/9 
  Verifying  : perl-IO-Compress-2.061-2.el7.noarch                                                                                                                                                            5/9 
  Verifying  : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64                                                                                                                                                    6/9 
  Verifying  : perl-DBI-1.627-4.el7.x86_64                                                                                                                                                                    7/9 
  Verifying  : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64                                                                                                                                                     8/9 
  Verifying  : perl-PlRPC-0.2020-14.el7.noarch                                                                                                                                                                9/9 

Installed:
  mariadb-server.x86_64 1:5.5.68-1.el7                                                                                                                                                                            

Dependency Installed:
  perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7    perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7    perl-DBD-MySQL.x86_64 0:4.023-6.el7    perl-DBI.x86_64 0:1.627-4.el7    perl-Data-Dumper.x86_64 0:2.145-3.el7   
  perl-IO-Compress.noarch 0:2.061-2.el7           perl-Net-Daemon.noarch 0:0.48-5.el7            perl-PlRPC.noarch 0:0.2020-14.el7     

Complete!
  1. 启动服务
[root@test01 ~]# systemctl start mariadb
[root@test01 ~]# systemctl status mariadb
● mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
   Active: active (running) since Sat 2021-11-06 17:59:50 CST; 6s ago
  Process: 1715 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=0/SUCCESS)
  Process: 1632 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
 Main PID: 1714 (mysqld_safe)
   CGroup: /system.slice/mariadb.service
           ├─1714 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
           └─1879 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/run/mariadb/mariadb.pid --socket=/v...

Nov 06 17:59:48 test01 mariadb-prepare-db-dir[1632]: MySQL manual for more instructions.
Nov 06 17:59:48 test01 mariadb-prepare-db-dir[1632]: Please report any problems at http://mariadb.org/jira
Nov 06 17:59:48 test01 mariadb-prepare-db-dir[1632]: The latest information about MariaDB is available at http://mariadb.org/.
Nov 06 17:59:48 test01 mariadb-prepare-db-dir[1632]: You can find additional information about the MySQL part at:
Nov 06 17:59:48 test01 mariadb-prepare-db-dir[1632]: http://dev.mysql.com
Nov 06 17:59:48 test01 mariadb-prepare-db-dir[1632]: Consider joining MariaDB's strong and vibrant community:
Nov 06 17:59:48 test01 mariadb-prepare-db-dir[1632]: https://mariadb.org/get-involved/
Nov 06 17:59:48 test01 mysqld_safe[1714]: 211106 17:59:48 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
Nov 06 17:59:48 test01 mysqld_safe[1714]: 211106 17:59:48 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Nov 06 17:59:50 test01 systemd[1]: Started MariaDB database server.
[root@test01 ~]# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.

数据库的初始化过程:
- -basedir=path 指定mysql程序目录
- -datadir=path 指定数据信息的保存目录
- -user=mysql 让mysql管理数据目录700

  1. 给mysql数据库服务设置密码
[root@test01 ~]# mysqladmin -u root password '123456'
  • PHP服务部署
  1. 更新yum源/卸载系统自带的PHP软件
[root@test01 ~]# rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Retrieving https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
warning: /var/tmp/rpm-tmp.cAquxa: Header V4 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:epel-release-7-14                ################################# [100%]
[root@test01 ~]# rpm -ivh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
Retrieving https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
warning: /var/tmp/rpm-tmp.AcRa3a: Header V4 RSA/SHA1 Signature, key ID 62e74ca5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:webtatic-release-7-3             ################################# [100%]
[root@test01 ~]# yum install php71w php71w-fpm php71w-cli php71w-common php71w-devel php71w-gd php71w-pdo php71w-mysql php71w-mbstring php71w-bcmath php71w-embedded php71w-mcrypt php71w-pecl-redis php71w-pecl-mongodb
  1. 编写配置文件
    将/etc/php-fpm.d/www.conf中的user和group改成都www
[root@test01 ~]# egrep 'user|group' /etc/php-fpm.d/www.conf |grep -v '^;'
user = www
group = www
[root@test01 ~]# systemctl start php-fpm
[root@test01 ~]# systemctl status php-fpm
● php-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; disabled; vendor preset: disabled)
   Active: active (running) since Sat 2021-11-06 18:36:46 CST; 5s ago
 Main PID: 2196 (php-fpm)
   Status: "Ready to handle connections"
   CGroup: /system.slice/php-fpm.service
           ├─2196 php-fpm: master process (/etc/php-fpm.conf)
           ├─2198 php-fpm: pool www
           ├─2199 php-fpm: pool www
           ├─2200 php-fpm: pool www
           ├─2201 php-fpm: pool www
           └─2202 php-fpm: pool www

Nov 06 18:36:45 test01 systemd[1]: Starting The PHP FastCGI Process Manager...
Nov 06 18:36:46 test01 systemd[1]: Started The PHP FastCGI Process Manager.

LNMP架构原理

nginx+php+mysql
在这里插入图片描述

实现LNMP之间建立关系

  • 实现nginx + php建立关系
    编写nginx配置文件
[root@test01 conf.d]# cat blog.conf
server {
   listen        80;
   server_name   blog.xcnyunyun.com;
   location  / {
     root  /html/blog;
     index index.html;
   }
   location ~ \.php$ { 当访问动态页面启动这个location
      root /html/blog;  #指定站点目录
      fastcgi_index index.php; #指定首页文件
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #指定url和uri信息
      fastcgi_pass 127.0.0.1:9000; #和PHP关联
      include fastcgi_params; #加载一个变量配置文件
   }
}

编写一个php测试文件

[root@test01 blog]# cat index.php 
<?php 
        phpinfo(); 
?>

访问测试
综合架构-网站架构LNMP_第1张图片

  • 实现PHP和mysql建立关系
    编写php代码文件
[root@test01 blog]# cat index_mysql.php
<?php
 $servername = "localhost";
 $username = "root";
 $passwd = "123456";
 $conn = mysqli_connect($servername, $username, $passwd);
 if ($conn) {
       echo "succ";
    }else{
       die("fail:" . mysqli_connect_error());
    }
?>

测试访问
综合架构-网站架构LNMP_第2张图片

部署搭建网站页面(代码上线)

  1. 获取代码信息(git) —使用开源的网站代码
    https://wordpress.org/download/
  2. 将代码解压,将解压后信息放入到站点目录中
[root@test01 html]# cd /html/
[root@test01 html]# tar -xzvf wordpress-5.8.1.tar.gz
[root@test01 html]# cd wordpress
[root@test01 wordpress]# ls
index.php    readme.html      wp-admin            wp-comments-post.php  wp-content   wp-includes        wp-load.php   wp-mail.php      wp-signup.php     xmlrpc.php
license.txt  wp-activate.php  wp-blog-header.php  wp-config-sample.php  wp-cron.php  wp-links-opml.php  wp-login.php  wp-settings.php  wp-trackback.php
[root@test01 wordpress]# mv ./* /html/blog/index
index.html       index_mysql.php  index.php        
[root@test01 wordpress]# mv ./* /html/blog/
mv: overwrite ‘/html/blog/index.php’? y
[root@test01 wordpress]# ls
[root@test01 wordpress]# ls /html/blog/
index.html       index.php    readme.html      wp-admin            wp-comments-post.php  wp-content   wp-includes        wp-load.php   wp-mail.php      wp-signup.php     xmlrpc.php
index_mysql.php  license.txt  wp-activate.php  wp-blog-header.php  wp-config-sample.php  wp-cron.php  wp-links-opml.php  wp-login.php  wp-settings.php  wp-trackback.php
  1. 修改站点目录权限
[root@test01 wordpress]# cd /html/
[root@test01 html]# ls
bbs  blog  bog  wordpress  wordpress-5.8.1.tar.gz  www
[root@test01 html]# ll
total 14740
drwxr-xr-x. 2 root   root        24 Oct 27 04:29 bbs
drwxr-xr-x. 5 root   root      4096 Nov  6 19:47 blog
drwxr-xr-x. 2 root   root         6 Nov  6 19:09 bog
drwxr-xr-x. 2 nobody 65534        6 Nov  6 19:47 wordpress
-rw-r--r--. 1 root   root  15087630 Nov  6 19:43 wordpress-5.8.1.tar.gz
drwxr-xr-x. 6 root   root       106 Nov  4 05:17 www
[root@test01 html]# chown -R www.www blog
[root@test01 html]# ll
total 14740
drwxr-xr-x. 2 root   root        24 Oct 27 04:29 bbs
drwxr-xr-x. 5 www    www       4096 Nov  6 19:47 blog
drwxr-xr-x. 2 root   root         6 Nov  6 19:09 bog
drwxr-xr-x. 2 nobody 65534        6 Nov  6 19:47 wordpress
-rw-r--r--. 1 root   root  15087630 Nov  6 19:43 wordpress-5.8.1.tar.gz
drwxr-xr-x. 6 root   root       106 Nov  4 05:17 www
  1. 进行网站页面初始化操作
    输入blog.xcnyunyun.com/index.php
    综合架构-网站架构LNMP_第3张图片
  2. 对数据库服务进行配置
    创建数据库
    综合架构-网站架构LNMP_第4张图片
    创建数据库
[root@test01 html]# mysql -uroot -p123456
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 5.5.68-MariaDB MariaDB Server

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

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

MariaDB [(none)]> create databases wordpress;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'databases wordpress' at line 1
MariaDB [(none)]> create database wordpress;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
| wordpress          |
+--------------------+
5 rows in set (0.00 sec)

创建数据库管理用户

[root@test01 html]# mysql -uroot -p123456
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 11
Server version: 5.5.68-MariaDB MariaDB Server

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

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

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

综合架构-网站架构LNMP_第5张图片
综合架构-网站架构LNMP_第6张图片
访问测试
综合架构-网站架构LNMP_第7张图片
在location /中没有index.php的首页文所以上面的定义的http://blog.xcnyunyun.com/wp-admin/找不到首页文件,所以不显示

[root@test01 blog]# cat /etc/nginx/conf.d/blog.conf
server {
   listen        80;
   server_name   blog.xcnyunyun.com;
   location  / {
     root  /html/blog;
     index index.php index.html;
   }
   location ~ \.php$ {
      root /html/blog;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      fastcgi_pass 127.0.0.1:9000;
      include fastcgi_params;
   }

}

综合架构-网站架构LNMP_第8张图片

关于LNMP的疑问

  • 上传大文件报413错误
    vi nginx.conf
    设置client_max_body_size 20m或更大
  • 如何让LNMP架构和存储服务器建立关系
  1. 找出图片存储的目录
    第一个方法
    根据图片链接地址获取图片存储位置
    第二个方法
    先定位数据存放在站点目录中
    find /html/blog -type f - mmin -5
  2. 使web服务器和存储服务器建立关系
    检查存储服务是否正常
    showmount -e IP地址
    将web服务器blog存储的数据进行迁移
    NFS方法
  • 如何让LNMP架构和数据库服务器建立关系
  1. 将web服务器本地数据库进行备份
    mysqldump -u root -p123456 --all-database > /tmp/web_bak.sql
  2. 将备份数据进行迁移
    scp /tmp/web_bak.sql 192.168.192.193:/tmp
  3. 恢复数据信息
    安装Mysql
    mysql -uroot -p123456
  4. 修改数据库服务器中数据库用户信息
    优化:删除无用的用户信息
 delete from mysql.user where user="" and host="localhost";

删除user列是空的和host列是localhost的

 delete from mysql.user where user="" and host="web01";

删除user列是空的和host列是web01的
添加新的用户信息

grant all on wordpress.* to 'wordpress'@'192.168.192.%' identified by '123456';

使192.168.192的网段可以使用wordpress连接

  1. 修改web服务器的代码文件信息
    修改数据库连接配置
  2. 停止原本本地mysql上的服务器
  3. 将修改数据库连接的配置文件分发到别的web服务器

你可能感兴趣的:(综合架构,架构,nginx,服务器)