博客
关于我
分布式部署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/

你可能感兴趣的文章
Net.Framework概述
查看>>
NET3.0+中使软件发出声音[整理篇]<转>
查看>>
net::err_aborted 错误码 404
查看>>
NetApp凭借领先的混合云数据与服务把握数字化转型机遇
查看>>
NetAssist网络调试工具使用指南 (附NetAssist工具包)
查看>>
Netbeans 8.1启动参数配置
查看>>
NetBeans IDE8.0需要JDK1.7及以上版本
查看>>
NetBeans之JSP开发环境的搭建...
查看>>
NetBeans之改变难看的JSP脚本标签的背景色...
查看>>
netbeans生成的maven工程没有web.xml文件 如何新建
查看>>
netcat的端口转发功能的实现
查看>>
NetCore 上传,断点续传,可支持流上传
查看>>
Netcraft报告: let's encrypt和Comodo发布成千上万的网络钓鱼证书
查看>>
Netem功能
查看>>
netfilter应用场景
查看>>
Netflix:当你按下“播放”的时候发生了什么?
查看>>
Netflix推荐系统:从评分预测到消费者法则
查看>>
netframework 4.0内置处理JSON对象
查看>>
Netgear WN604 downloadFile.php 信息泄露漏洞复现(CVE-2024-6646)
查看>>
Netgear wndr3700v2 路由器刷OpenWrt打造全能服务器(十一)备份
查看>>