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

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

nginx服务部署

在本次部署中,我们将在三个虚拟机节点上分别配置以下服务:

① nginx节点配置

进入nginx节点,修改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;}location ~ .php$ {    root     /www;    fastcgi_pass  192.168.128.42:9000;    fastcgi_index  index.php;    include        fastcgi_params;}

同时,添加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;

②创建用户和用户组

通过文件传输工具将wordpress安装包复制到nginx节点和PHP节点的/usr/local/src目录下:

安装包下载地址:https://pan.baidu.com/s/12c7fjyVBvknzh0lp_PRHYg

提取码:4730

在nginx节点执行以下命令:

[root@nginx ~]# mkdir /www[root@nginx ~]# chown nginx:nginx /www[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[root@php ~]# yum -y install unzip[root@php ~]# unzip wordpress-4.7.3-zh_CN.zip[root@php ~]# mv wordpress/* /www/

③配置wordpress文件

在nginx节点中,拷贝并修改wp-config.php文件:

[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');  // ** 创建数据表时默认的文字编码 */  define('DB_CHARSET', 'utf8');  // ** 数据库整理类型。如不确定请勿更改 */  define('DB_COLLATE', '');

将配置好的文件传输至PHP节点:

[root@nginx ~]# scp /www/wp-config.php root@192.168.128.144:/www/

④数据库节点配置

在主数据库节点上创建wordpress数据库:

[root@mysql0 ~]# mysql -uroot -pSICTMariaDB [(none)]> create database wordpress;Query OK, 1 row affected (0.00 sec)MariaDB [(none)]> exitBye

⑤验证WordPress应用

在nginx节点重启nginx服务:

[root@nginx ~]# nginx -s reload

在浏览器中访问nginx地址,系统将自动启动WordPress五分钟安装程序:

填写必要信息,完成安装即可。

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

你可能感兴趣的文章
OSPF技术连载12:OSPF LSA泛洪——维护网络拓扑的关键
查看>>
OSPF技术连载13:OSPF Hello 间隔和 Dead 间隔
查看>>
OSPF技术连载14:OSPF路由器唯一标识符——Router ID
查看>>
OSPF技术连载15:OSPF 数据包的类型、格式和邻居发现的过程
查看>>
OSPF技术连载16:DR和BDR选举机制,一篇文章搞定!
查看>>
OSPF技术连载17:优化OSPF网络性能利器——被动接口!
查看>>
OSPF技术连载18:OSPF网络类型:非广播、广播、点对多点、点对多点非广播、点对点
查看>>
OSPF技术连载19:深入解析OSPF特殊区域
查看>>
SQL Server 复制 订阅与发布
查看>>
OSPF技术连载20:OSPF 十大LSA类型,太详细了!
查看>>
OSPF技术连载21:OSPF虚链路,现代网络逻辑连接的利器!
查看>>
OSPF技术连载22:OSPF 路径选择 O > O IA > N1 > E1 > N2 > E2
查看>>
OSPF技术连载2:OSPF工作原理、建立邻接关系、路由计算
查看>>
OSPF技术连载5:OSPF 基本配置,含思科、华为、Junifer三厂商配置
查看>>
OSPF技术连载6:OSPF 多区域,近7000字,非常详细!
查看>>
OSPF技术连载7:什么是OSPF带宽?OSPF带宽参考值多少?
查看>>
OSPF技术连载8:OSPF认证:明文认证、MD5认证和SHA-HMAC验证
查看>>
OSPF故障排除技巧
查看>>
spring配置文件中<context:property-placeholder />的使用
查看>>
OSPF有哪些优势?解决了RIP的什么问题?
查看>>