分布式部署LNMP+WordPress

需要四台虚拟机,实际上,我们只需要操作三台

一个数据库,一个nginx,一个php,还需要准备一个软件包wordpress-4.7.3-zh_C

首先配置nginx的服务环境

root@nginx \~\]# vi /usr/local/nginx/conf/nginx.conf 修改文件中的location下的 root /www; index 添加index.php 下面有两个location \~ .php$ 改第二处 将这部分整个大括号内容的注释#取消,然后root /www; fstcgi_pass192.168.200.131:9000; 这是php的主机ip根据自己的情况设置 保存退出 \[root@nginx \~\]# vi /usr/local/nginx/conf/fstcgi_params fastcgi_param SCRIPT_NAME $fastcgi_script_name; **fastcgi_param SCRIPT_FILENAME d o c u m e n t r o o t document_root documentrootfastcgi_script_name;** 添加 fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param DOCUMENT_ROOT $document_root; fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param REQUEST_SCHEME $scheme; fastcgi_param HTTPS $https if_not_empty; 创建目录 \[root@nginx \~\]# mkdir /www \[root@nginx \~\]# chown nginx:nginx /www/ 在php主机上操作 \[root@php \~\]# mkdir /www \[root@php \~\]# chown nginx:nginx /www/ 使用 FX工具将压缩包wordpress-4.7.3-zh_C上传到nginx和php主机上的/root目录下, cd 回root目录 \[root@nginx \~\]# cd /root \[root@nginx \~\]# unzip wordpress-4.7.3-zh_C.zip \[root@nginx \~\]# mv wordpress/\* /www/ php主机也是一样操作 \[root@php \~\]# cd /root \[root@php \~\]# unzip wordpress-4.7.3-zh_C.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', '000000'); /\*\* MySQL主机 \*/ 主数据库的ip define('DB_HOST', '192.168.200.10'); /\*\* 创建数据表时默认的文字编码 \*/ define('DB_CHARSET', 'utf8'); /\*\* 数据库整理类型。如不确定请勿更改 \*/ define('DB_COLLATE', ''); \[root@nginx \~\]# scp /www/wp-config.phproot@192.168.200.131:/www/ usage: scp \[-12346BCpqrv\] \[-c cipher\] \[-F ssh_config\] \[-i identity_file

-l limit\] \[-o ssh_option\] \[-P port\] \[-S program

\[user@\]host1:\]file1 ... \[\[user@\]host2:\]file2 然后配置主数据库 进入数据库 Welcome to the MariaDB monitor. Commands end with ; or \\g. Your MariaDB connection id is 4 Server version: 5.5.44-MariaDB-log MariaDB Server Copyright © 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.06 sec) \[root@nginx \~\]# nginx -s reload 再打开网页 ![在这里插入图片描述](https://file.jishuzhan.net/article/1773609822713810945/e45c9db1a2f2b787da03c33f49bc15c7.webp)

相关推荐
明达智控技术11 分钟前
MR30分布式I/O模块服务换热站项目,守护万家温暖
分布式·物联网·自动化
stevenzqzq12 分钟前
android recyclerview缓存_缓存问题解决办法
android·java·缓存
武子康12 分钟前
Java-174 FastFDS 从单机到分布式文件存储:实战与架构取舍
java·大数据·分布式·性能优化·系统架构·dfs·fastdfs
失散1314 分钟前
分布式专题——56 微服务日志采集与分析系统实战
java·分布式·微服务·架构
失散1318 分钟前
分布式专题——57 如何保证MySQL数据库到ES的数据一致性
java·数据库·分布式·mysql·elasticsearch·架构
下位子29 分钟前
『OpenGL学习滤镜相机』- Day10: 相机预览与 OpenGL 结合
android·opengl
那就逆流而上吧41 分钟前
Android AIDL 的详细讲解和实践指南
android
方圆想当图灵2 小时前
Nacos 源码深度畅游:注册中心核心流程详解
分布式·后端·github
TDengine (老段)2 小时前
TDengine 字符串函数 POSITION 用户手册
android·java·大数据·数据库·物联网·时序数据库·tdengine
小坏讲微服务3 小时前
Spring Cloud Alibaba 2025.0.0 与 Nacos 3.1.0 集群整合
分布式·nacos·架构·springcloud·nacos集群·springalibaba