博客
关于我
分布式部署LNMP+WordPress
阅读量:462 次
发布时间:2019-03-06

本文共 3287 字,大约阅读时间需要 10 分钟。

转:

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_paramsfastcgi_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/

③配置wordpress文件

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 -pSICTWelcome to the MariaDB monitor.  Commands end with ; or g.Your MariaDB connection id is 7Server version: 5.5.44-MariaDB-log MariaDB ServerCopyright (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)]> exitBye[root@mysql0 ~]#

⑤验证WordPress应用

Nginx节点

[root@nginx ~]# nginx -s reload

在浏览器中键入nginx地址

出现著名的WordPress五分钟安装程序,填写必要的信息,然后单击左下角“安装 WordPress”按钮,进行 WordPress应用的安装。

转:

转载地址:http://zvzbz.baihongyu.com/

你可能感兴趣的文章
Nacos 单机集群搭建及常用生产环境配置 | Spring Cloud 3
查看>>
Nacos 启动报错[db-load-error]load jdbc.properties error
查看>>
Nacos 报Statement cancelled due to timeout or client request
查看>>
Nacos 注册服务源码分析
查看>>
Nacos 融合 Spring Cloud,成为注册配置中心
查看>>
Nacos-注册中心
查看>>
Nacos-配置中心
查看>>
Nacos2.X 源码分析:为订阅方推送、服务健康检查、集群数据同步、grpc客户端服务端初始化
查看>>
Nacos2.X 配置中心源码分析:客户端如何拉取配置、服务端配置发布客户端监听机制
查看>>
Nacos2.X源码分析:服务注册、服务发现流程
查看>>
NacosClient客户端搭建,微服务注册进nacos
查看>>
Nacos中使用ribbon
查看>>
Nacos使用OpenFeign
查看>>
Nacos使用Ribbon
查看>>
Nacos做注册中心使用
查看>>
Nacos做配置中心使用
查看>>
Nacos入门过程的坑--获取不到配置的值
查看>>
Nacos原理
查看>>
Nacos发布0.5.0版本,轻松玩转动态 DNS 服务
查看>>
Nacos启动异常
查看>>